Skip to content

Commit 20deaa8

Browse files
author
Stephane Landelle
committed
Fix invalidUri test, crappy url format should be supported
1 parent d55c4e0 commit 20deaa8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

api/src/main/java/org/asynchttpclient/RequestBuilderBase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ public T setUrl(String url) {
373373
}
374374

375375
public T setURI(URI uri) {
376+
if (uri.getPath() == null)
377+
throw new IllegalArgumentException("Unsupported uri format: " + uri);
376378
request.originalUri = uri;
377379
addQueryParameters(request.originalUri);
378380
request.uri = null;

api/src/test/java/org/asynchttpclient/async/AsyncProvidersBasicTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,12 +1556,11 @@ public void headShouldNotAllowBody() throws IllegalArgumentException, IOExceptio
15561556
}
15571557
}
15581558

1559-
@Test(groups = { "standalone", "default_provider" })
1559+
@Test(groups = { "standalone", "default_provider" }, expectedExceptions = { IllegalArgumentException.class })
15601560
public void invalidUri() throws Exception {
15611561
AsyncHttpClient client = getAsyncHttpClient(null);
15621562
try {
1563-
Response response = client.executeRequest(client.prepareGet(String.format("http:127.0.0.1:%d/foo/test", port1)).build()).get();
1564-
assertEquals(200, response.getStatusCode());
1563+
client.prepareGet(String.format("http:127.0.0.1:%d/foo/test", port1)).build();
15651564
} finally {
15661565
client.close();
15671566
}

0 commit comments

Comments
 (0)