add test to make sure HttpGetter supports compression

This commit is contained in:
Athou
2024-07-29 13:20:18 +02:00
parent 1b1d3c791b
commit 72f55c34b7

View File

@@ -174,6 +174,23 @@ class HttpGetterTest {
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
void largeFeedWithContentLengthHeader() {
byte[] bytes = new byte[(int) DataSize.kilobytes(100).toBytes()];