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

skip parsing HttpBody field and pass query params as-is #13679

Merged
merged 3 commits into from
Dec 3, 2020

Conversation

CurryX
Copy link
Contributor

@CurryX CurryX commented Oct 21, 2020

Commit Message: skip parsing HttpBody field and pass query params as-is
Additional Description: Check the request url, if there is any HttpBody, and method_info->request_body_field_path is not a prefix of resolved_binding.field_path, skip parsing HttpBody field. This avoid we may skip some HttpBody objects which were intended to be configurable by query arguments.
Testing: Add a new unit test to cover the changes.
Docs Changes: n/a
Fixes #13634

@CurryX CurryX requested a review from lizan as a code owner October 21, 2020 17:08
@CurryX
Copy link
Contributor Author

CurryX commented Oct 21, 2020

/wait
working on couple of changes.

@@ -860,6 +860,20 @@ TEST_F(GrpcJsonTranscoderFilterTest, TranscodingUnaryPostWithHttpBody) {
EXPECT_THAT(request, ProtoEq(expected_request));
}

TEST_F(GrpcJsonTranscoderFilterTest, TranscodingUnaryGetWithHttpBody) {
const std::string path = "/echoRawBody?data=oops%7b";
Copy link
Contributor

Choose a reason for hiding this comment

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

Not quite understand the intention of setting data parameter here? Does it want transcoder to set its value to the HttpBody.data field?

I don't see the code to copy it to the HttpBody.data field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code shouldn't write data field in to HttpBody.data because HttpBody field shouldn't be override by query param. This test is to test when there is a query param is named with data, and endpoint wants a raw httpbody request info, transcoder should handle this correctly.

@CurryX
Copy link
Contributor Author

CurryX commented Oct 22, 2020

/wait Sorry for the back and forth, but is working on adding several test scenarios to make it more understandable. :p

qiwzhang
qiwzhang previously approved these changes Oct 26, 2020
Copy link
Contributor

@qiwzhang qiwzhang left a comment

Choose a reason for hiding this comment

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

LGTM

@CurryX
Copy link
Contributor Author

CurryX commented Oct 28, 2020

Ughh, apparently dumb me follow the wrong sign-off process, reopen this pr. @qiwzhang I will need one more time of approval, really appreciate your help. :D

@CurryX CurryX reopened this Oct 28, 2020
Signed-off-by: Curry Xu <[email protected]>
@qiwzhang
Copy link
Contributor

You may need to fix the format first. You can run

tools/code_format/check_format.py fix modified-cc-files

@CurryX
Copy link
Contributor Author

CurryX commented Nov 30, 2020

@lizan Hi! Could you take a look at this and let me know if this can be merged or if I need to do anything else? Thank you! :)

@lizan lizan merged commit 17ad085 into envoyproxy:master Dec 3, 2020
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.

JSON transcoder parsed some query params and cause transcoder error
3 participants