jsonplaceholder icon indicating copy to clipboard operation
jsonplaceholder copied to clipboard

Proper HTTP codes for some responses

Open igorsantos07 opened this issue 11 years ago • 2 comments

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 Found response. Trying to GET /santa-claus I receive a 500 instead.
  • When a method is not accepted for a given resource the server should return a 405 Method Not Allowed instead of the 404 I'm currently getting. Example: PATCH /posts

igorsantos07 avatar Apr 24 '14 23:04 igorsantos07

I agree there's room for improvements here. JSONPlaceholder depends on an old version of JSON-Server.

Especially the PATCH method should work.

typicode avatar May 06 '14 10:05 typicode

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.

igorsantos07 avatar May 06 '14 20:05 igorsantos07