Merge pull request #13 from fpringvaldsen/Request-Options-String-Constructor
Add RequestOptions constructor with string
This commit is contained in:
commit
f012782c82
2 changed files with 3 additions and 1 deletions
|
@ -8,6 +8,7 @@ import org.apache.http.nio.client.HttpAsyncClient;
|
|||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Map;
|
||||
|
||||
public class RequestOptions {
|
||||
|
@ -26,6 +27,7 @@ public class RequestOptions {
|
|||
private ResponseBodyType as = ResponseBodyType.STREAM;
|
||||
private Map<String, String> queryParams;
|
||||
|
||||
public RequestOptions (String url) throws URISyntaxException { this.uri = new URI(url); }
|
||||
public RequestOptions(URI uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
[jetty9/jetty9-service test-web-service]
|
||||
{:webserver {:port 10000}}
|
||||
(testing "java async client"
|
||||
(let [options (RequestOptions. (URI. "http://localhost:10000/hello/"))
|
||||
(let [options (RequestOptions. "http://localhost:10000/hello/")
|
||||
response (java-method options)]
|
||||
(is (= 200 (.getStatus (.deref response))))
|
||||
(is (= "Hello, World!" (slurp (.getBody (.deref response)))))))
|
||||
|
|
Loading…
Reference in a new issue