Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong HTTP status 206 #312

Closed
RedGlow opened this issue May 14, 2016 · 2 comments
Closed

Wrong HTTP status 206 #312

RedGlow opened this issue May 14, 2016 · 2 comments

Comments

@RedGlow
Copy link
Contributor

RedGlow commented May 14, 2016

While I was looking for the /v2/recipes?ids=... endpoint, I noticed that there is a wrong HTTP status management. To sum it up:

  • All the ids are known: a 200 status is returned (correct)
  • Non of the ids known: a 404 status is returned (and that seems correct to me too)
  • Some of the ids are known, and some not: a 206 status is returned. This is not correct.

A 206 status is used for obtaining parts of a content through the use of the range headers: https://tools.ietf.org/html/rfc7233 . In this case, we have a correct answer, so a 200 is in order.

@lye
Copy link
Contributor

lye commented May 15, 2016

I agree that we're breaking the RFC, but we wanted to use a non-200 status code to indicate a partial success.

An RFC-compliant implementation would accept the id list as a Range header (and the server would emit an Accept-Range: ids header in bulk-expanded responses, as per RFC 2616§3.12). Pragmatically, that breaks horribly due to CORS restrictions (the Range header makes the request non-simple, thus requiring a preflight -- and our backend infrastructure doesn't support OPTIONS requests) -- this is the same reasoning behind the ?access_token option (rather than requiring an Authorization header).

I think a good way to think about it is that 206 is the correct status code; it's just that we botched how the requests are sent.

Let me know if you want us to add support for ids sent via a Range header though.

@RedGlow
Copy link
Contributor Author

RedGlow commented May 17, 2016

I see now the reasoning (and reasons!) behind.

I suppose that a full conformity to the RFC makes sense only when the CORS preflight will be supported on the backend.

@RedGlow RedGlow closed this as completed May 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants