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

Error output should have lowercase attribute names #244

Merged
merged 1 commit into from
Oct 25, 2016
Merged

Error output should have lowercase attribute names #244

merged 1 commit into from
Oct 25, 2016

Conversation

nathanborror
Copy link
Contributor

The current error output is titlecase ({"Error": "...", "Code": "..."}) when it should be lowercase ({"error": "...", "code": "..."}). This appears to be due to errorBody implementing proto.Message interface but lacking protobuf tags needed to marshal correctly. When I patch errorBody with the following I end up with correct behavior:

type errorBody struct {
    Error string `protobuf:"bytes,1,name=error" json:"error"`
    Code  int    `protobuf:"bytes,2,name=code" json:"code"`
}

Adding protobuf tags to `errorBody` to get proper lowercased output when marshaled.
@yugui
Copy link
Member

yugui commented Oct 25, 2016

LGTM. Thank you for your contribution.

I'll fix the test failure with tip version of Go later.

@yugui yugui merged commit 3254889 into grpc-ecosystem:master Oct 25, 2016
@tamalsaha tamalsaha mentioned this pull request Mar 30, 2017
1 task
adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
Adding protobuf tags to `errorBody` to get proper lowercased output when marshaled.
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

Successfully merging this pull request may close these issues.

None yet

2 participants