mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
add test to make sure HttpGetter supports compression
This commit is contained in:
@@ -174,6 +174,23 @@ class HttpGetterTest {
|
|||||||
Assertions.assertEquals(2, calls.get());
|
Assertions.assertEquals(2, calls.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void supportsCompression() {
|
||||||
|
this.mockServerClient.when(HttpRequest.request().withMethod("GET")).respond(req -> {
|
||||||
|
String acceptEncodingHeader = req.getFirstHeader(HttpHeaders.ACCEPT_ENCODING);
|
||||||
|
if (!acceptEncodingHeader.contains("deflate")) {
|
||||||
|
throw new Exception("deflate should be in the Accept-Encoding header");
|
||||||
|
}
|
||||||
|
if (!acceptEncodingHeader.contains("gzip")) {
|
||||||
|
throw new Exception("gzip should be in the Accept-Encoding header");
|
||||||
|
}
|
||||||
|
|
||||||
|
return HttpResponse.response().withBody("ok");
|
||||||
|
});
|
||||||
|
|
||||||
|
Assertions.assertDoesNotThrow(() -> getter.getBinary(this.feedUrl, TIMEOUT));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void largeFeedWithContentLengthHeader() {
|
void largeFeedWithContentLengthHeader() {
|
||||||
byte[] bytes = new byte[(int) DataSize.kilobytes(100).toBytes()];
|
byte[] bytes = new byte[(int) DataSize.kilobytes(100).toBytes()];
|
||||||
|
|||||||
Reference in New Issue
Block a user