Merge pull request #13 from fpringvaldsen/Request-Options-String-Constructor

Add RequestOptions constructor with string
This commit is contained in:
Chris Price 2014-08-22 15:29:57 -07:00
commit f012782c82
2 changed files with 3 additions and 1 deletions

View file

@ -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;
}

View file

@ -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)))))))