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

Return codes.InvalidArgument to rather return HTTP 400 instead of HTTP 500 #397

Closed
wants to merge 3 commits into from

Conversation

pieterlouw
Copy link

Hi,

Currently if there's a conversion error on the request then the gateway return an HTTP 500 with the Go error in the HTTP Body.

Won't it be clearer to the API client user if a codes.InvalidArgument (that translate to HTTP 400) is returned rather?

Pieter

@achew22
Copy link
Collaborator

achew22 commented May 27, 2017

Pieter, this seems reasonable to me. Could you sign the CLA and add a test to verify the new behavior?

@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.

@achew22
Copy link
Collaborator

achew22 commented May 29, 2017

Generally I believe you should test it in the smallest size test that completely validates behavior. Since template.go is generating a string that is going to be compiled by the go compiler I don't know that we can fully test the functionality in template.go. Therefore, I think the test should go in integration.go. If you have a nifty trick for testing it in template.go I would love to learn.

@achew22
Copy link
Collaborator

achew22 commented May 29, 2017

Oh, I should also note that since you're modifying a template you will need to run make examples in the root directory to update all the example code with your change.

Thanks!

@pieterlouw
Copy link
Author

Closing this as #409 have test case and examples

@pieterlouw pieterlouw closed this Jun 9, 2017
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.

3 participants