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

Changed to use more appropriate http status code for ResourceExhausted #580

Merged
merged 3 commits into from
Apr 3, 2018

Conversation

eleniums
Copy link
Contributor

HTTPStatusFromCode should be mapping codes.ResourceExhausted to http.StatusRequestEntityTooLarge (https://httpstatuses.com/413) as it is the more appropriate HTTP status. The current mapping of http.StatusServiceUnavailable seems to indicate a temporary problem with the server, when in reality it is an issue with the client sending a request that is too large.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot
Copy link

CLAs look good, thanks!

@johanbrandhorst
Copy link
Collaborator

Arguably the correct mapping is that defined by the Google protobuf error code proto file; 429 Too Many Requests.

@achew22
Copy link
Collaborator

achew22 commented Apr 3, 2018

+1, it should be 429. Could you also add a link to https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto in the function comment?

@johanbrandhorst
Copy link
Collaborator

Looks like there are more codes that should be chaged, FailedPrecondition should be 400 Bad Request, not 412 PreconditionFailed. This is probably a good time to review all the codes.

@achew22
Copy link
Collaborator

achew22 commented Apr 3, 2018

@johanbrandhorst, If you want to send in a PR that fixes it and updates the comment on the function I'm happy to merge it today.

@eleniums
Copy link
Contributor Author

eleniums commented Apr 3, 2018

My initial reason for bringing this up was that the instances in grpc-go where ResourceExhausted is currently being used are related to message size, not the resource actually being exhausted. I thought that 413 PAYLOAD TOO LARGE would be a more appropriate mapping, given the current implementation.

That being said, in order to be consistent, it does make sense to map the codes based on https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto. I'll make the necessary adjustments and push a commit soon.

Copy link
Collaborator

@achew22 achew22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When Travis is done I'll merge. Please ping if I forget

@achew22 achew22 merged commit 261dafe into grpc-ecosystem:master Apr 3, 2018
@achew22
Copy link
Collaborator

achew22 commented Apr 3, 2018

Thanks so much @eleniums for contributing!

adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants