refactor(aio): unify error messages for invalid requests to upload-server
Previously, there was a distinction between GET requests to invalid URLs and all other requests. This was mainly because the upload-server only accepts GET requests, but that is not a hard limitation and may change in the future. Thus, it makes sense to return a 404 response for requests to invalid URLs regardless of the method used.
This commit is contained in:

committed by
Pete Bacon Darwin

parent
11647e4c78
commit
8cfc2e2ec0
@ -105,8 +105,7 @@ class UploadServerFactory {
|
||||
}
|
||||
});
|
||||
middleware.get(/^\/health-check\/?$/, (_req, res) => res.sendStatus(200));
|
||||
middleware.get('*', req => this.throwRequestError(404, 'Unknown resource', req));
|
||||
middleware.all('*', req => this.throwRequestError(405, 'Unsupported method', req));
|
||||
middleware.all('*', req => this.throwRequestError(404, 'Unknown resource', req));
|
||||
middleware.use((err: any, _req: any, res: express.Response, _next: any) => this.respondWithError(res, err));
|
||||
|
||||
return middleware;
|
||||
|
Reference in New Issue
Block a user