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

Correct reading HTTP client response body without content type + ByteBuffer converters #10975

Merged
merged 2 commits into from
Jul 15, 2024

Conversation

dstepanov
Copy link
Contributor

The buffer of the client response should be discarded

@dstepanov dstepanov added the type: improvement A minor improvement to an existing feature label Jul 12, 2024
@dstepanov dstepanov requested review from graemerocher and yawkat July 12, 2024 09:20
@dstepanov dstepanov changed the title Correct reading HTTP client response body without content type Correct reading HTTP client response body without content type + ByteBuffer converters Jul 12, 2024
conversionService.addConverter(
java.nio.ByteBuffer.class,
ByteBuf.class,
nioBuffer -> Unpooled.copiedBuffer(nioBuffer)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why copy and not wrap?

}
});
if (res instanceof FullNettyClientHttpResponse response) {
response.onComplete();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure we don't need the onComplete here

@@ -1447,7 +1432,6 @@ public void onComplete() {
try {
FullHttpResponse fullHttpResponse = new DefaultFullHttpResponse(nettyResponse.protocolVersion(), nettyResponse.status(), buffer, nettyResponse.headers(), new DefaultHttpHeaders(true));
final FullNettyClientHttpResponse<Object> fullNettyClientHttpResponse = new FullNettyClientHttpResponse<>(fullHttpResponse, handlerRegistry, (Argument<Object>) errorType, true, conversionService);
fullNettyClientHttpResponse.onComplete();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here


@Override
public void onComplete() {
this.complete = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, complete was unused? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the field was highlighted as not used

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants