Preserve content-length when calling mark in SdkLengthAwareInputStream#6408
Merged
alextwoods merged 4 commits intomasterfrom Sep 15, 2025
Merged
Preserve content-length when calling mark in SdkLengthAwareInputStream#6408alextwoods merged 4 commits intomasterfrom
alextwoods merged 4 commits intomasterfrom
Conversation
Fred1155
approved these changes
Sep 15, 2025
|
|
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Preserve content-length when calling mark in SdkLengthAwareInputStream
Motivation and Context
This does not change when exceptions are raised - it only changes the text in the exception.
Prior to this change, when
markwas called on aSdkLengthAwareInputStream, it would reset the expected length to be the remaining bytes. If all of the bytes were not read from the stream the exception would have the message:The request content has fewer bytes than the specified content-length: <length based on remaining bytes when mark was called>. With this change, the specified content-length in the exception will be the originally provided length.Modifications
lengthfinal on construction and adds a newmarkedRemainingto store the number of remaining bytes.Testing
New and existing tests
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License