Return 400 instead of 405 for invalid input#56
Open
nrktkt wants to merge 1 commit intoswagger-api:masterfrom
Open
Return 400 instead of 405 for invalid input#56nrktkt wants to merge 1 commit intoswagger-api:masterfrom
nrktkt wants to merge 1 commit intoswagger-api:masterfrom
Conversation
405 is "Method Not Allowed" which seems unlikely to be what we want. A generic 400 "Bad Request" seems like a better status for our documented message of "Invalid input". I was also inclined to combine some of these 400 "Invalid ID supplied" statuses into the 404s defined for the same method, but I understand that the 400 is probably meant to say "you passed a non-int id, so I'm not going to bother looking for your resource" as opposed to "I looked for your resource but couldn't find it".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
405 is "Method Not Allowed" which seems unlikely to be what we want. A generic 400 "Bad Request" seems like a better status for our documented message of "Invalid input".
I was also inclined to combine some of these 400 "Invalid ID supplied" statuses into the 404s defined for the same method, but I understand that the 400 is probably meant to say "you passed a non-int id, so I'm not going to bother looking for your resource" as opposed to "I looked for your resource but couldn't find it".