From f4422439057ef453843fb3a919a181a0893ca1a2 Mon Sep 17 00:00:00 2001 From: Violeta Georgieva Date: Fri, 2 Mar 2018 16:16:26 +0200 Subject: [PATCH] fix #303 After aggregating the content invoke the super method. --- .../http/client/HttpClientOperations.java | 2 +- .../ipc/netty/http/client/HttpClientTest.java | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/reactor/ipc/netty/http/client/HttpClientOperations.java b/src/main/java/reactor/ipc/netty/http/client/HttpClientOperations.java index 501a351799..c949395830 100644 --- a/src/main/java/reactor/ipc/netty/http/client/HttpClientOperations.java +++ b/src/main/java/reactor/ipc/netty/http/client/HttpClientOperations.java @@ -392,7 +392,7 @@ public NettyOutbound send(Publisher source) { .setInt(HttpHeaderNames.CONTENT_LENGTH, agg.readableBytes()); } - return send(Mono.just(agg)).then(); + return super.send(Mono.just(agg)).then(); })); } return super.send(source); diff --git a/src/test/java/reactor/ipc/netty/http/client/HttpClientTest.java b/src/test/java/reactor/ipc/netty/http/client/HttpClientTest.java index 3dfb36827c..647e1e8b30 100644 --- a/src/test/java/reactor/ipc/netty/http/client/HttpClientTest.java +++ b/src/test/java/reactor/ipc/netty/http/client/HttpClientTest.java @@ -887,4 +887,24 @@ private HttpClientOptions.Builder applyHostAndPortFromContext(HttpClientOptions. httpClientOptions.connectAddress(() -> context.address()); return httpClientOptions; } + + @Test + public void testIssue303() { + NettyContext server = + HttpServer.create(0) + .newHandler((req, resp) -> resp.sendString(Mono.just("OK"))) + .block(Duration.ofSeconds(30)); + + Mono content = + HttpClient.create(server.address().getPort()) + .get("/", req -> req.sendByteArray(Mono.defer(() -> Mono.just("Hello".getBytes())))) + .flatMap(it -> it.receive().aggregate().asString()); + + StepVerifier.create(content) + .expectNextMatches(s -> "OK".equals(s)) + .expectComplete() + .verify(Duration.ofSeconds(30)); + + server.dispose(); + } }