Skip to content

Commit afc4a0f

Browse files
committed
Use ByteBuf#isReadable instead of readableBytes() > 0
1 parent 5d487d0 commit afc4a0f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

client/src/main/java/org/asynchttpclient/netty/handler/AsyncHttpClientHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void channelRead(final ChannelHandlerContext ctx, Object msg) throws Exce
8282
if (msg instanceof HttpContent) {
8383
ByteBuf content = ((HttpContent) msg).content();
8484
// Republish as a HttpResponseBodyPart
85-
if (content.readableBytes() > 0) {
85+
if (content.isReadable()) {
8686
HttpResponseBodyPart part = config.getResponseBodyPartFactory().newResponseBodyPart(content, false);
8787
ctx.fireChannelRead(part);
8888
}

client/src/main/java/org/asynchttpclient/netty/handler/HttpHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private void handleChunk(HttpContent chunk,//
110110
}
111111

112112
ByteBuf buf = chunk.content();
113-
if (!abort && !(handler instanceof StreamedAsyncHandler) && (buf.readableBytes() > 0 || last)) {
113+
if (!abort && !(handler instanceof StreamedAsyncHandler) && (buf.isReadable() || last)) {
114114
HttpResponseBodyPart bodyPart = config.getResponseBodyPartFactory().newResponseBodyPart(buf, last);
115115
abort = handler.onBodyPartReceived(bodyPart) == State.ABORT;
116116
}

0 commit comments

Comments
 (0)