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

feat: add option to control using proto text name as key during URL encoding #3311

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

demoManito
Copy link
Member

@demoManito demoManito commented Apr 30, 2024

Description (what this PR does / why we need it):

  • binding.EncodeURL and form.EncodeValues and form.EncodeFieldMask add option.EncodeOption, used to control whether to use proto text name as key when encoding. and it will not affect the original logic
  • cmd/protoc-gen-go-http add the -prototext_encodeurl parameter to control whether to use the json tag defined in proto as the key when encoding. The default is false and will not change the original generated code logic. (example: kratos proto client api/test.proto -- --go-http_opt=prototext_encodeurl=true)

Which issue(s) this PR fixes (resolves / be part of):

resolves: #3141
resolves: #2761

Other special notes for the reviewers:

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 30, 2024
@demoManito demoManito changed the title feat(transport/http/binding): controls whether to use proto text name… feat(transport/http/binding): controls whether to use proto text name as the key of the parameter Apr 30, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.08%. Comparing base (d0d5761) to head (d2fd00e).

❗ Current head d2fd00e differs from pull request most recent head f353c83. Consider uploading reports for the commit f353c83 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3311      +/-   ##
==========================================
+ Coverage   81.83%   82.08%   +0.25%     
==========================================
  Files          92       93       +1     
  Lines        4205     4220      +15     
==========================================
+ Hits         3441     3464      +23     
+ Misses        582      578       -4     
+ Partials      182      178       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@demoManito demoManito changed the title feat(transport/http/binding): controls whether to use proto text name as the key of the parameter feat(transport/http/binding): controls whether to use proto text name as the key of the params Apr 30, 2024
@demoManito demoManito changed the title feat(transport/http/binding): controls whether to use proto text name as the key of the params feat(transport/http/binding): add option to control using proto text name as key during URL encoding Apr 30, 2024
@demoManito demoManito changed the title feat(transport/http/binding): add option to control using proto text name as key during URL encoding feat: add option to control using proto text name as key during URL encoding May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
2 participants