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

fix query params not populate if method is post #939

Merged
merged 9 commits into from
May 26, 2019

Conversation

mingqing
Copy link
Contributor

for http method post and content-type is application/x-www-form-urlencoded, the query parameters will be in Request.Form or Request.PostForm.

@johanbrandhorst
Copy link
Collaborator

Hi @mingqing, thanks for your pull request. The failing CI test is because you need to regenerate the example files. Please see CONTRIBUTING.md in the root of the repo for a docker one liner.

Also, could you add a test that fails before this change and works after it?

Thanks!

@codecov-io
Copy link

codecov-io commented May 19, 2019

Codecov Report

Merging #939 into master will decrease coverage by 0.05%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #939      +/-   ##
==========================================
- Coverage   53.84%   53.79%   -0.06%     
==========================================
  Files          40       40              
  Lines        3965     3969       +4     
==========================================
  Hits         2135     2135              
- Misses       1634     1638       +4     
  Partials      196      196
Impacted Files Coverage Δ
protoc-gen-grpc-gateway/gengateway/template.go 65.51% <ø> (ø) ⬆️
examples/server/a_bit_of_everything.go 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5f6fca...f031a59. Read the comment docs.

@mingqing
Copy link
Contributor Author

@johanbrandhorst I regenerated the file and added it, while passing the CI test.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

This still doesn't contain the test I requested. Please see the integration test folder for an example of a test. I would like you to add a new test case that exercises this new branch in the generated code please.

protoc-gen-grpc-gateway/gengateway/template.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

The latest update confuses me - I encourage you to add a test case before anything else.

@johanbrandhorst
Copy link
Collaborator

Thanks for the explanation, however, we still need a new test case that was failing before this change and is now passing. Do you need some help to write the test?

@mingqing
Copy link
Contributor Author

Thanks for the explanation, however, we still need a new test case that was failing before this change and is now passing. Do you need some help to write the test?

Is the test case added in examples/integration/integration_test.go? I will go add.

@johanbrandhorst
Copy link
Collaborator

Thanks for the explanation, however, we still need a new test case that was failing before this change and is now passing. Do you need some help to write the test?

Is the test case added in examples/integration/integration_test.go? I will go add.

Yes, that would be great, thanks.

@johanbrandhorst
Copy link
Collaborator

Thanks for adding the tests, I took the liberty of trying to run the tests without the changes applied and was pleased to see that the PostForm test failing, which makes it easier to understand the scope of the change.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

Thanks for the latest slew of changes, just a new small pointers then we can merge this!

examples/integration/integration_test.go Outdated Show resolved Hide resolved
examples/integration/integration_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

This looks great now, thanks a lot!

@johanbrandhorst johanbrandhorst merged commit e6f18d3 into grpc-ecosystem:master May 26, 2019
@johanbrandhorst
Copy link
Collaborator

Thanks for your contribution!

adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
* fix query params not populate if method is post

* regenerate example files.

* fix go.mod

* use req.From instead of req.PostForm to avoid missing url params in post method

* regenerate example files

* add test case and regenerate example files

* adjust to use subtests and remove confused variable

* use an explicit test name instead of the auto index

* rename local var url to apiURL avoid conflict with net/url
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