jsonplaceholder
jsonplaceholder copied to clipboard
Proper HTTP codes for some responses
I think some error requests are returning wrong HTTP codes... Not sure though, but according to the HTTP RFC:
- When a resource is non-existent it should return a
404 Not Foundresponse. Trying toGET /santa-clausI receive a 500 instead. - When a method is not accepted for a given resource the server should return a
405 Method Not Allowedinstead of the404I'm currently getting. Example:PATCH /posts
I agree there's room for improvements here. JSONPlaceholder depends on an old version of JSON-Server.
Especially the PATCH method should work.
Actually, PATCH does work (except for #9). I said that based on conflicting doc (#5). I'm not really sure if there's any verb that's not supported by the service... Maybe it could reply 405 for, say, OPTIONS? This way we can write tests that handle correctly unsupported verbs.