add regression test

This commit is contained in:
Athou
2024-10-04 20:24:43 +02:00
parent 99a02a2186
commit 98cfa6d2c8

View File

@@ -239,6 +239,24 @@ class HttpGetterTest {
Assertions.assertEquals("ok", new String(result.getContent()));
}
@Test
void doesNotUseUpgradeProtocolHeader() {
AtomicInteger calls = new AtomicInteger();
this.mockServerClient.when(HttpRequest.request().withMethod("GET")).respond(req -> {
calls.incrementAndGet();
if (req.containsHeader(HttpHeaders.UPGRADE)) {
throw new Exception("upgrade header should not be sent by the client");
}
return HttpResponse.response().withBody("ok");
});
Assertions.assertDoesNotThrow(() -> getter.get(this.feedUrl));
Assertions.assertEquals(1, calls.get());
}
@Nested
class Compression {