Skip to content

Commit

Permalink
handle netty chunking of large request body karatelabs#1528
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrthomas committed Mar 26, 2021
1 parent 75c912a commit 965784c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ public byte[] build() {
contentTypeHeader = request.headers().get(HttpConstants.HDR_CONTENT_TYPE);
// logger.debug("content type header: {}", contentTypeHeader);
ByteBuf content;
if (multipart) {
if (request instanceof FullHttpRequest) {
FullHttpRequest fullRequest = (FullHttpRequest) request;
content = fullRequest.content();
} else {
content = Unpooled.buffer();
HttpContent data;
while ((data = encoder.readChunk(ByteBufAllocator.DEFAULT)) != null) {
content.writeBytes(data.content());
}
} else {
FullHttpRequest fullRequest = (FullHttpRequest) request;
content = fullRequest.content();
}
byte[] bytes = new byte[content.readableBytes()];
content.readBytes(bytes);
Expand Down

0 comments on commit 965784c

Please sign in to comment.