@Test public void ok() throws IOException { HttpResponse res = HttpClient.DEFAULT .get(uri("/ok")) .addHeader("X-Status", "200") .addHeader("X-Length", "-1") .send(); Assertions.assertEquals(200, res.status()); }
@Test public void unavailableEmptyChunked() throws IOException { HttpResponse res = HttpClient.DEFAULT .get(uri("/ok")) .addHeader("X-Status", "503") .addHeader("X-Length", "0") .send(); Assertions.assertEquals(503, res.status()); }
@Test public void emptyChunked() throws IOException { HttpResponse res = HttpClient.DEFAULT .get(uri("/ok")) .addHeader("X-Status", "200") .addHeader("X-Length", "0") .send(); Assertions.assertEquals(200, res.status()); }
@Test public void unavailableEmpty() throws IOException { HttpResponse res = HttpClient.DEFAULT .get(uri("/ok")) .addHeader("X-Status", "503") .addHeader("X-Length", "-1") .send(); Assertions.assertEquals(503, res.status()); }
@Test public void okWithBody() throws IOException { HttpResponse res = HttpClient.DEFAULT .post(uri("/echo")) .addHeader("X-Status", "200") .withContent("text/plain", "foo") .send(); Assertions.assertEquals(200, res.status()); Assertions.assertEquals("foo", res.entityAsString()); }
@Test public void okWithCompressedBody() throws IOException { HttpResponse res = HttpClient.DEFAULT .post(uri("/echo")) .acceptGzip() .addHeader("X-Status", "200") .withContent("text/plain", "foo") .compress() .send() .decompress(); Assertions.assertEquals(200, res.status()); Assertions.assertEquals("foo", res.entityAsString()); } }