Wrong status code for 'invalid request payload' errors? #464
Labels
A-Client-Server
Issues affecting the CS API
clarification
An area where the expected behaviour is understood, but the spec could do with being more explicit
The specification suggests in various places to use the
400
status code for invalid request payloads, eg. theM_UNKNOWN
error for a bad login type on the login route, or theM_MISSING_PARAM
error on the/pushers/set
route.The more appropriate status code here would probably be
422
instead:(source)
This part of the specification claims that...
... which means that in this case, some of the currently-
400
errors could theoretically be safely represented as422
s (namely, those with an error code other thanM_UNKNOWN
), but all of theM_UNKNOWN
errors - like that in the login route - could not be.However, with the current ambiguity in the specification on whether the HTTP status codes are normative or non-normative, there's a good chance that some clients are relying on these sort of errors having a
400
status code either way,M_UNKNOWN
or not. Which means that this seems like it would need a specification change to resolve, unless there's some sort of existing guidance on this that I'm not aware of.The text was updated successfully, but these errors were encountered: