-
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 all 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 an issue in SdkHttpUtils used in SdkHttpFullRequest where constructing with a query string consisting of a single \"=\" would throw an ArrayIndexOutOfBoundsException." | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -238,6 +238,36 @@ 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?" |
||||||||||||||||||||||||||||||||||||||||||||||
void uriParamsWithSingleEqualQuery() { | ||||||||||||||||||||||||||||||||||||||||||||||
URI uri = URI.create("http://example.com?="); | ||||||||||||||||||||||||||||||||||||||||||||||
Map<String, List<String>> uriParams = SdkHttpUtils.uriParams(uri); | ||||||||||||||||||||||||||||||||||||||||||||||
assertThat(uriParams).containsKey(""); | ||||||||||||||||||||||||||||||||||||||||||||||
assertThat(uriParams.get("")) | ||||||||||||||||||||||||||||||||||||||||||||||
.isNotNull() | ||||||||||||||||||||||||||||||||||||||||||||||
.hasSize(1) | ||||||||||||||||||||||||||||||||||||||||||||||
.containsNull(); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
@Test | ||||||||||||||||||||||||||||||||||||||||||||||
void uriParamsWithSingleEqualWithValueQuery() { | ||||||||||||||||||||||||||||||||||||||||||||||
URI uri = URI.create("http://example.com?=nokeyvalue"); | ||||||||||||||||||||||||||||||||||||||||||||||
Map<String, List<String>> uriParams = SdkHttpUtils.uriParams(uri); | ||||||||||||||||||||||||||||||||||||||||||||||
assertThat(uriParams).containsKey(""); | ||||||||||||||||||||||||||||||||||||||||||||||
assertThat(uriParams.get("")) | ||||||||||||||||||||||||||||||||||||||||||||||
.isNotNull() | ||||||||||||||||||||||||||||||||||||||||||||||
.hasSize(1) | ||||||||||||||||||||||||||||||||||||||||||||||
.contains("nokeyvalue"); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
@Test | ||||||||||||||||||||||||||||||||||||||||||||||
void uriParamsWithWithEmptyValueQuery() { | ||||||||||||||||||||||||||||||||||||||||||||||
URI uri = URI.create("http://example.com?novaluekey="); | ||||||||||||||||||||||||||||||||||||||||||||||
Map<String, List<String>> uriParams = SdkHttpUtils.uriParams(uri); | ||||||||||||||||||||||||||||||||||||||||||||||
assertThat(uriParams).containsKey("novaluekey"); | ||||||||||||||||||||||||||||||||||||||||||||||
assertThat(uriParams.get("novaluekey")) | ||||||||||||||||||||||||||||||||||||||||||||||
.hasSize(1) | ||||||||||||||||||||||||||||||||||||||||||||||
.containsNull(); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
@Test | ||||||||||||||||||||||||||||||||||||||||||||||
void parseSingleNonProxyHost(){ | ||||||||||||||||||||||||||||||||||||||||||||||
String singleHostName = "singleHost" ; | ||||||||||||||||||||||||||||||||||||||||||||||
|
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.
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.
Do you mean
return new String[] {"", null};
in line 410? cause otherwise it will fail on original line 410There 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.
ah I see, yup