diff --git a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/RequestTest.java b/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/RequestTest.java index d3ee7619db1..53a93a174a1 100644 --- a/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/RequestTest.java +++ b/tests/integration/webclient/src/test/java/io/helidon/tests/integration/webclient/RequestTest.java @@ -143,51 +143,56 @@ public void testTemporaryRedirect() throws Exception { fail(throwable); return null; }) - .toCompletableFuture() - .get(); + .await(); } @Test public void testPermanentRedirect() throws Exception { - webClient.put() - .path("/redirect/permanent") + WebClientResponse response = webClient.put() + .path("/greeting") .submit(JSON_NEW_GREETING) - .thenAccept(response -> assertThat(response.status().code(), is(204))) - .thenCompose(nothing -> webClient.get() - .request(JsonObject.class)) - .thenAccept(jsonObject -> assertThat(jsonObject.getString("message"), is("Hola World!"))) - .thenCompose(nothing -> webClient.put() - .path("/greeting") - .submit(JSON_OLD_GREETING)) - .thenAccept(response -> assertThat(response.status().code(), is(204))) - .exceptionally(throwable -> { - fail(throwable); - return null; - }) - .toCompletableFuture() .get(); + assertThat(response.status().code(), is(204)); + + JsonObject jsonObject = webClient.get() + .request(JsonObject.class).await(); + assertThat(jsonObject.getString("message"), is("Hola World!")); + + + webClient.put() + .path("/greeting") + .submit(JSON_OLD_GREETING).get(); + + WebClientResponse secondResponce = webClient.put() + .path("/greeting") + .submit(JSON_OLD_GREETING) + .get(); + assertThat(secondResponce.status().code(), is(204)); } @Test public void testPut() throws Exception { - webClient.put() + WebClientResponse response = webClient.put() .path("/greeting") .submit(JSON_NEW_GREETING) - .thenAccept(response -> assertThat(response.status().code(), is(204))) - .thenCompose(nothing -> webClient.get() - .request(JsonObject.class)) - .thenAccept(jsonObject -> assertThat(jsonObject.getString("message"), is("Hola World!"))) - .thenCompose(nothing -> webClient.put() - .path("/greeting") - .submit(JSON_OLD_GREETING)) - .thenAccept(response -> assertThat(response.status().code(), is(204))) - .exceptionally(throwable -> { - fail(throwable); - return null; - }) - .toCompletableFuture() .get(); + assertThat(response.status().code(), is(204)); + + JsonObject jsonObject = webClient.get() + .request(JsonObject.class).await(); + assertThat(jsonObject.getString("message"), is("Hola World!")); + + + webClient.put() + .path("/greeting") + .submit(JSON_OLD_GREETING).get(); + + WebClientResponse secondResponce = webClient.put() + .path("/greeting") + .submit(JSON_OLD_GREETING) + .get(); + assertThat(secondResponce.status().code(), is(204)); } @Test diff --git a/webclient/webclient/src/main/java/io/helidon/webclient/NettyClientHandler.java b/webclient/webclient/src/main/java/io/helidon/webclient/NettyClientHandler.java index fc31c7cd239..ae728b6435f 100644 --- a/webclient/webclient/src/main/java/io/helidon/webclient/NettyClientHandler.java +++ b/webclient/webclient/src/main/java/io/helidon/webclient/NettyClientHandler.java @@ -146,7 +146,7 @@ protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws IO requestConfiguration.cookieManager().put(requestConfiguration.requestURI(), clientResponse.headers().toMap()); - // Set entity to channel if further forwarding is required + // Get entity from channel if further forwarding is required Flow.Publisher entity = channel.attr(REQUEST_ENTITY).get(); for (HttpInterceptor interceptor : HTTP_INTERCEPTORS) {