-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add an "Allow" header to the response when a 405 error occures? #467
Comments
The validator should probably do this automatically. If you want to take a stab at it, you can have a peek here where the 405 is returned and think through how to add the allow header with the allowed http methods to the response. Note, to do it via app code you could check for the 405 Method not allowed on your error middleware. |
cdimascio
added a commit
that referenced
this issue
Dec 16, 2020
cdimascio
added a commit
that referenced
this issue
Dec 19, 2020
ahilke
added a commit
to ahilke/express-openapi-validator
that referenced
this issue
Mar 12, 2021
The Allow header must be sent if the server responds with 405 to indicate which request methods can be used. See cdimascio#467.
ahilke
added a commit
to ahilke/express-openapi-validator
that referenced
this issue
Mar 12, 2021
The Allow header must be sent if the server responds with 405 to indicate which request methods can be used. See cdimascio#467
ahilke
added a commit
to ahilke/express-openapi-validator
that referenced
this issue
Mar 12, 2021
Adds Allow header to 405 error. This is required by RFC 7231 and indicates which request methods can be used. Resolves cdimascio#467
cdimascio
pushed a commit
that referenced
this issue
Mar 13, 2021
* chore: Fix Typos * test: Add Test Case for Allow Header The Allow header must be sent if the server responds with 405 to indicate which request methods can be used. See #467 * feat: Add Allow Header for 405 - Method Not Allowed Adds Allow header to 405 error. This is required by RFC 7231 and indicates which request methods can be used. Resolves #467 * doc: Adjust Error Handler in NestJS Example When using a custom error handler like in the NestJS example, one needs to set the headers on the response explicitly. The same is true when using a custom express error handler.
available in |
This was referenced Mar 15, 2021
Closed
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On a "method not allowed" (
405
) error, I'd like to be able to add a Allow header to the response. This header would contain the valid methods.For example, if a path only supports
GET
requests, and aPOST
request is received, I'd like to be able to send aAllow: GET
header.Do you know how to achieve that?
The text was updated successfully, but these errors were encountered: