-
Notifications
You must be signed in to change notification settings - Fork 910
allow single "=" as query #5823
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
Changes from 6 commits
d9c97fd
cb53e75
6ab6e5e
a1fd7b8
3abd9db
a3cf660
2c7d947
b514e28
343587b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "bugfix", | ||
"category": "AWS SDK for Java v2", | ||
"contributor": "", | ||
"description": "Fixed the bug \"ArrayIndexOutOfBoundsException\" when single \"=\" as the query string" | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -405,6 +405,7 @@ public static Map<String, List<String>> uriParams(URI uri) { | |||||||||||||||||
return splitQueryString(uri.getRawQuery()) | ||||||||||||||||||
.stream() | ||||||||||||||||||
.map(s -> s.split("=")) | ||||||||||||||||||
.map(s -> s.length == 0 ? new String[] {""} : s) | ||||||||||||||||||
.map(s -> s.length == 1 ? new String[] { s[0], null } : s) | ||||||||||||||||||
Comment on lines
+408
to
409
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah I see, yup |
||||||||||||||||||
.collect(groupingBy(a -> urlDecode(a[0]), mapping(a -> urlDecode(a[1]), toList()))); | ||||||||||||||||||
} | ||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -238,6 +238,13 @@ public void uriParams() throws URISyntaxException { | |||||||||||||||||||||||||||||||||||||||||||||
entry("decoded&Part", Arrays.asList("equals=val"))); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
@Test | ||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also for completeness can we add test in SdkHttpRequestResponseTest since this tests the Public API @Test
public void testSdkHttpRequestWithEmptyEqualQueryParameterName() {
final String expected = "http://example.com?=";
URI myUri = URI.create(expected);
SdkHttpRequest actual = SdkHttpRequest.builder().method(SdkHttpMethod.POST).uri(myUri).build();
assertThat(actual.getUri()).hasToString(expected);
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test will fail because our current implementation will eliminate "=" when there are no query values. I added a test that the expected result string is "http://example.com?" |
||||||||||||||||||||||||||||||||||||||||||||||
public void uriParamsWithSingleEqualQuery() throws URISyntaxException { | ||||||||||||||||||||||||||||||||||||||||||||||
URI uri = URI.create("http://example.com?="); | ||||||||||||||||||||||||||||||||||||||||||||||
Map<String, List<String>> uriParams = SdkHttpUtils.uriParams(uri); | ||||||||||||||||||||||||||||||||||||||||||||||
assertThat(uriParams).contains(entry("", Arrays.asList((String)null))); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
@Test | ||||||||||||||||||||||||||||||||||||||||||||||
void parseSingleNonProxyHost(){ | ||||||||||||||||||||||||||||||||||||||||||||||
String singleHostName = "singleHost" ; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be specific about the fix is made in SdkHttpFullRequest
or something that is more specific ?