From 38fa775de72721a1385562bf225cd9dbf898fd7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maltoni?= Date: Tue, 10 Dec 2024 13:53:42 +0100 Subject: [PATCH] test: fix Http2HeadersTest --- .../java/org/carapaceproxy/core/Http2HeadersTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/carapace-server/src/test/java/org/carapaceproxy/core/Http2HeadersTest.java b/carapace-server/src/test/java/org/carapaceproxy/core/Http2HeadersTest.java index 3c6d6894..ce95a8ba 100644 --- a/carapace-server/src/test/java/org/carapaceproxy/core/Http2HeadersTest.java +++ b/carapace-server/src/test/java/org/carapaceproxy/core/Http2HeadersTest.java @@ -51,6 +51,7 @@ public void test() throws IOException, ConfigurationNotValidException, Interrupt .withBody("it works !!")) ); final var mapper = new TestEndpointMapper("localhost", wireMockRule.port()); + final HttpClientResponse response; try (final var server = new HttpProxyServer(mapper, tmpDir.newFolder())) { server.addListener(new NetworkListenerConfiguration( "localhost", @@ -72,7 +73,7 @@ public void test() throws IOException, ConfigurationNotValidException, Interrupt server.start(); final var port = server.getLocalPort(); - final HttpClientResponse response = HttpClient.create() + response = HttpClient.create() .protocol(HttpProtocol.H2C, HttpProtocol.HTTP11) .headers(headers -> headers .add(HttpHeaderNames.CONNECTION, "keep-alive") @@ -83,9 +84,9 @@ public void test() throws IOException, ConfigurationNotValidException, Interrupt .uri("http://localhost:" + port + "/index.html") .response() .block(); - assertThat(response, is(notNullValue())); - assertThat(response.status(), is(HttpResponseStatus.OK)); - assertThat(response.version(), is(HttpVersion.HTTP_1_1)); } + assertThat(response, is(notNullValue())); + assertThat(response.status(), is(HttpResponseStatus.OK)); + assertThat(response.version(), is(HttpVersion.valueOf("HTTP/2.0"))); } }