feat: Support multiple duplicate queryparams#134
Merged
shwetha-manvinkurke merged 1 commit intosendgrid:mainfrom Feb 2, 2022
Merged
feat: Support multiple duplicate queryparams#134shwetha-manvinkurke merged 1 commit intosendgrid:mainfrom
shwetha-manvinkurke merged 1 commit intosendgrid:mainfrom
Conversation
bd8105d to
ece8a9d
Compare
shwetha-manvinkurke
approved these changes
Jan 14, 2022
Contributor
|
Could you pull in the latest changes from main? |
The SendGrid API documentation states that the user can supply up to ten
categories, but there is no way to supply them using the Java library.
This commit fixes the problem by interpreting any value that has an
ampersand in it as a list of values, which will be inserted as multiple
query params.
For example, the call request.addQueryParam("categories", "cat1&cat2")
will output "?categories=cat1&categories=cat2" into the URL.
ece8a9d to
02be68f
Compare
Contributor
Author
|
Rebased and pushed. |
shwetha-manvinkurke
approved these changes
Feb 2, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The SendGrid API documentation states that the user can supply up to ten
categories, but there is no way to supply them using the Java library.
This commit fixes the problem by interpreting any value that has an
ampersand in it as a list of values, which will be inserted as multiple
query params.
For example, the call
request.addQueryParam("categories", "cat1&cat2")will output
categories=cat1&categories=cat2into the URL.I also modified the
testbuildUritest a bit because I would have had writeout too many permutations of the resulting URL string because the order
of the query params is not deterministic in the current implementation.
Another solution would be to store the query params in
Map<String, String[]>so we wouldn't need to split the string. Then the user could just call
This would, however, change the API of the library, so I didn't go for this route now.
Fixes
A short description of what this PR does.
Checklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.