Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ByteBody-based response handling for the HTTP client #11177

Merged
merged 17 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.micronaut.http.client.exceptions;

import io.micronaut.core.annotation.Internal;

/**
* @author Graeme Rocher
* @since 1.0
Expand All @@ -35,4 +37,15 @@ public ContentLengthExceededException(long maxLength, long receivedLength) {
public ContentLengthExceededException(long maxLength) {
super("The received length exceeds the maximum allowed content length [" + maxLength + "]");
}

/**
* Constructor with a message, useful for adapting from
* {@link io.micronaut.http.exceptions.ContentLengthExceededException}.
*
* @param message The message
*/
@Internal
public ContentLengthExceededException(String message) {
super(message);
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ public class FullNettyClientHttpResponse<B> implements HttpResponse<B>, NettyHtt
this.nettyHttpResponse = fullHttpResponse;
// this class doesn't really have lifecycle management (we don't make the user release()
// it), so we have to copy the data to a non-refcounted buffer.
ByteBuf buffer = Unpooled.buffer(fullHttpResponse.content().readableBytes());
buffer.writeBytes(fullHttpResponse.content(), 0, fullHttpResponse.content().readableBytes());
this.unpooledContent = Unpooled.unreleasableBuffer(buffer);
this.unpooledContent = Unpooled.unreleasableBuffer(Unpooled.copiedBuffer(fullHttpResponse.content()));
this.handlerRegistry = handlerRegistry;
this.nettyCookies = new NettyCookies(fullHttpResponse.headers(), conversionService);
Class<?> rawBodyType = bodyType != null ? bodyType.getType() : null;
Expand Down
Loading
Loading