Skip to content

Document that BodyState.STOP may carry the final bytes#2255

Merged
hyperxpro merged 1 commit into
mainfrom
docs-stop-carries-data
Jul 18, 2026
Merged

Document that BodyState.STOP may carry the final bytes#2255
hyperxpro merged 1 commit into
mainfrom
docs-stop-carries-data

Conversation

@hyperxpro

Copy link
Copy Markdown
Member

Motivation:

PR #2232 changed MultipartBody.transferTo() to return STOP on the same call that writes the body's final bytes, meaning STOP may still be accompanied by unread data in the target buffer. However, BodyState.STOP is currently documented as meaning "nothing to read," and AuthenticatorUtils's auth-int loop assumes this behavior, which would truncate such a body (currently unreachable because multipart bodies do not use this path).

Modification:

Update the Body.transferTo() and BodyState.STOP documentation to clarify that STOP may accompany the final bytes and that consumers must drain the target buffer before stopping. Add a comment in the auth-int loop documenting its assumption.

Result:

The STOP-with-data contract is explicitly documented, and the existing assumption in AuthenticatorUtils is clearly identified. Documentation only; no behavioral changes.

@hyperxpro
hyperxpro merged commit 2afcbde into main Jul 18, 2026
17 checks passed
@hyperxpro
hyperxpro deleted the docs-stop-carries-data branch July 18, 2026 21:34
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