Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 899 Bytes

File metadata and controls

45 lines (33 loc) · 899 Bytes

HttpClient

A fluent HTTP client for Java/TeaVM.

Example Usage

PostRequest request =
    new PostRequest("http://httpbin.org/post", new HttpStringBody("hello world"));
HttpResponse<InputStream> response = HttpClient.post(request);
InputStream body = response.getBody();

or

InputStream inputStream = createStream();
PostRequest request =
    new PostRequest("http://httpbin.org/post", new HttpInputStreamBody(inputStream));
HttpResponse<String> response = HttpClient.post(request);
String body = response.getBody();

Setup with Maven

mvn clean install

Add dependency

<dependency>
   <groupId>com.divroll</groupId>
   <artifactId>httpclient</artifactId>
   <version>SNAPSHOT</version>
</dependency>

Run test

mvn test -Dteavm.junit.target=target/js-tests -Dteavm.junit.js.runner=htmlunit -Dteavm.junit.js.threads=2