Skip to content

Fix response body accessors for bodyless and rebuilt responses - #2329

Merged
hyperxpro merged 3 commits into
mainfrom
fix/empty-body-and-builder-list
Sep 17, 2026
Merged

hyperxpro merged 3 commits into
mainfrom
fix/empty-body-and-builder-list

Conversation

@hyperxpro

Copy link
Copy Markdown
Member

Motivation:

ResponseBuilder#build() hands out the list it accumulates into, and AsyncCompletionHandler resets that builder on every onStatusReceived. A handler reused for a second request empties the first response and refills it with the
second body.

NettyResponse#getResponseBodyAsByteBuf() sizes a composite to the part count, and CompositeByteBuf rejects zero components, so a bodyless response throws instead of returning an empty buffer.

The body view added in #2322 names three of the four holders of its array, and its NettyResponse override replaced the inherited description, dropping the read-only warning from the only published implementation.

Modification:

Copy the parts in build(), floor the composite at one component, name getBodyByteBuffer() as the fourth holder, and restore the inherited text with {@inheritDoc}.

Result:

A response keeps its own body when its builder is reused, a bodyless response yields an empty buffer, and the view names every holder it has.

@hyperxpro hyperxpro changed the title Fix/empty body and builder list Fix response body accessors for bodyless and rebuilt responses Sep 17, 2026
@hyperxpro
hyperxpro merged commit 73a9ed8 into main Sep 17, 2026
17 checks passed
@hyperxpro
hyperxpro deleted the fix/empty-body-and-builder-list branch September 17, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant