-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Non-standard use of 412 HTTP Status Code #972
Comments
Yep this is wrong. We should use the one defined in code.proto. It is a backwards-incompatible change, as you say, but I'm tempted to say that it was a bug and so a bug fix should be issued and a patch release made. Would you like to submit this change? Any more thoughts on breaking users here @achew22 @tmc? |
This is the code.proto source of truth we should use: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto#L127. |
Thanks for your quick response. I hadn't found the I am happy to make the change later. |
This is just a bug. Send in a patch and I'll merge it |
Fixes grpc-ecosystem#972 (and reverses grpc-ecosystem#657). This now returns the semantically correct `400` response, rather than a `412`. This matches the gRPC documentation.
Fixes grpc-ecosystem#972 (and reverses grpc-ecosystem#657). This now returns the semantically correct `400` response, rather than a `412`. This matches the gRPC documentation.
Currently a gRPC
FAILED_PRECONDITION
error gets translated to a HTTP status code of412 Precondition Failed
. However, this is semantically incorrect.The RFC for the HTTP status code (https://tools.ietf.org/html/rfc7232#section-4.2):
This does not match what the gRPC
FAILED_PRECONDITION
semantics (https://github.com/grpc/grpc/blob/master/doc/statuscodes.md):The gRPC documentation referenced above also suggests a
400 Bad request
being the closest HTTP mapping (I suspect this is where the value came from before it was changed by #657.Having run into this this morning, I ran into a Stack Overflow response that confirmed my feelings https://stackoverflow.com/questions/10730852/http-status-code-400-vs-412.
While changing the response back to
400 Bad request
would be the "correct" thing to do, I can see how that would be a breaking change for some people. I also miss the separation between the two different types of errors (there's also the possibility of a422
response, but the new wording for400
possibly changes my opinion—https://stackoverflow.com/questions/16133923/400-vs-422-response-to-post-of-data).The text was updated successfully, but these errors were encountered: