![]() For example, when you try to upload a file that's too big to some sites, you might get a 400 error instead of an error letting you know about the maximum file size. Some servers that are not configured properly can also throw 400 errors instead of more helpful errors in some situations. ![]() Or maybe your web browser is trying to use an expired or invalid cookie. Perhaps you've mistyped a URL and the server can't return a 404 Error, for some reason. Michael Kropat put together a pretty useful set of diagrams to determine the most suitable status code for each situation.A 400 Bad Request error can happen because there's a simple error in the request. Sending the right status code is as important as proving a payload that describes the problem and helps your client to determine the cause of the error.įor reporting problems in your HTTP API, I advise you to have a look at the RFC 7807: it defines simple JSON and XML document formats to inform the client about a problem in a HTTP API and also defines the application/problem+json and application/problem+xml media types. You could probably go for the generic 400 to express a bad request or go for 403 to indicate that the request is forbidden. ![]() Both 406 and 200 are unsuitable for this situation:Ĥ06 is meant for content negotiation, when the server cannot send a representation of a particular resource with the media type indicated in the Accept header of the request.Ģ00 must be used when the operation has succeeded, what's not the case.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |