When to reply 400 Bad Request
- by KajMagnus
According to www.w3.org, a Web server should reply with status code 400 Bad Request if:
"The request could not be understood by the server due
to malformed syntax. The client SHOULD NOT repeat the
request without modifications"
Does that mean only request that violates some HTTP spec?
Or does it include a request that my particular Web app thinks is broken?
When would you reply 400?
For example, if my Web app expects a query string to always include a "function=..." parameter, would you reply code 400 Bad Request or 403 Forbidden? (403 means that "The server understood the request, but is refusing to fulfill it.")