Skip to content

Commit

Permalink
Apply comments
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Aleksandrov <dmitry.aleksandrov@oracle.com>
  • Loading branch information
dalexandrov committed Sep 15, 2023
1 parent 14c3fe7 commit afa108f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DataChunk> entity = channel.attr(REQUEST_ENTITY).get();

for (HttpInterceptor interceptor : HTTP_INTERCEPTORS) {
Expand Down

0 comments on commit afa108f

Please sign in to comment.