Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public static URI createURIWithQuery(URI uri, String query) throws URISyntaxExce
if (before != null) {
s = before;
}
if (query != null) {
if (query != null && !query.isEmpty()) {
s = s + "?" + query;
}
if (!s.contains("#") && uri.getFragment() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ public void testCreateURIWithQueryHasOneFragmentAndQueryParameter() throws Excep
assertEquals("smtp://localhost?utm_campaign=launch#fragmentOne", resultUri.toString());
}

@Test
public void testCreateURIWithQueryEmptyQueryString() throws Exception {
URI uri = new URI("https://api.example.com/users/myuser/repos");
URI resultUri = URISupport.createURIWithQuery(uri, "");
assertNotNull(resultUri);
assertEquals("https://api.example.com/users/myuser/repos", resultUri.toString());
}

@Test
public void testNormalizeEndpointWithEqualSignInParameter() throws Exception {
String out = URISupport.normalizeUri("jms:queue:foo?selector=somekey='somevalue'&foo=bar");
Expand Down
Loading