Permalink
Browse files

fix #303 After aggregating the content invoke the super method.

  • Loading branch information...
violetagg committed Mar 2, 2018
1 parent 7cd547f commit f4422439057ef453843fb3a919a181a0893ca1a2
@@ -392,7 +392,7 @@ public NettyOutbound send(Publisher<? extends ByteBuf> source) {
.setInt(HttpHeaderNames.CONTENT_LENGTH,
agg.readableBytes());
}
return send(Mono.just(agg)).then();
return super.send(Mono.just(agg)).then();
}));
}
return super.send(source);
@@ -887,4 +887,24 @@ private HttpClient createHttpClientForContext(NettyContext context) {
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<String> 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();
}
}

0 comments on commit f442243

Please sign in to comment.