@Override
public NettyOutbound send(Publisher<? extends ByteBuf> source) {
if (method() == HttpMethod.GET || method() == HttpMethod.HEAD) {
ByteBufAllocator alloc = channel().alloc();
return then(Flux.from(source)
.doOnNext(ByteBuf::retain)
.collect(alloc::buffer, ByteBuf::writeBytes)
.flatMapMany(agg -> {
if (!hasSentHeaders() && !HttpUtil.isTransferEncodingChunked(
outboundHttpMessage()) && !HttpUtil.isContentLengthSet(
outboundHttpMessage())) {
outboundHttpMessage().headers()
.setInt(HttpHeaderNames.CONTENT_LENGTH,
agg.readableBytes());
}
return send(Mono.just(agg)).then();
}));
}
return super.send(source);
}
HttpClientOperations.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:reactor-netty
作者:
评论列表
文章目录