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

Its impossible to send response with non 200 status code #901

Closed
Kuzey27 opened this issue Mar 8, 2019 · 3 comments
Closed

Its impossible to send response with non 200 status code #901

Kuzey27 opened this issue Mar 8, 2019 · 3 comments

Comments

@Kuzey27
Copy link

Kuzey27 commented Mar 8, 2019

If I want to give response with non ok status code then I can't send a message. But I may want to send cause of this error and some solution for it in my message

@johanbrandhorst
Copy link
Collaborator

Is this request for other 2xx status codes of for returning more information in the error? Why can't you simply include more information in the error?

@Kuzey27
Copy link
Author

Kuzey27 commented Mar 8, 2019

Is this request for other 2xx status codes of for returning more information in the error? Why can't you simply include more information in the error?
For example : I want to raise 429 error and send a captcha-token, I this line of code:
context.set_code(grpc.StatusCode.RESOURCE_EXHAUSTED)
And after that I can't send a captcha-token in message

@johanbrandhorst
Copy link
Collaborator

You can set the message of the error before returning it. I'm not familiar with the snippet you've posted, but whatever language your gRPC server is written in will support some way to set a message in addition to this method for setting a code. This message is returned in the grpc-gateway response.

I will close this issue since I think this is covered by existing functionality. If you need further help with your setup please reach out in the #grpc-gateway channel of the Gophers slack channel: https://invite.slack.golangbridge.org/.

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