fix: Respect caller-supplied Content-Encoding for pre-compressed request bodies - #997
Open
vdusek wants to merge 2 commits into
Open
fix: Respect caller-supplied Content-Encoding for pre-compressed request bodies#997vdusek wants to merge 2 commits into
vdusek wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #997 +/- ##
==========================================
- Coverage 94.72% 94.71% -0.02%
==========================================
Files 58 58
Lines 5332 5334 +2
==========================================
+ Hits 5051 5052 +1
- Misses 281 282 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Mantisus
approved these changes
Aug 3, 2026
Mantisus
left a comment
Collaborator
There was a problem hiding this comment.
One nit, otherwise LGTM
| compressing them itself. The API accepts `gzip`, `br`, `deflate`, and `identity`, and stores the | ||
| record exactly as uploaded, so this also becomes the encoding the record is served with. | ||
| timeout: Timeout for the API HTTP request. | ||
| """ |
Collaborator
There was a problem hiding this comment.
Could we add a guard that rejects a non-byte value (and non-file?) when content_encoding declares a compression?
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A caller-supplied
Content-Encodingnow marks the request body as already encoded, so the client forwards it untouched instead of dropping the header (since #987) or overwriting it (before #987).How it works
_prepare_request_call: callerContent-Encoding-> content-type heuristic -> size threshold -> compress. The header alone is the "hands off" signal, as inapify-client-js, so no opt-out parameter lands on the publicHttpClientABC. Lookups go through a new case-insensitive_get_header.deflate) work too, andidentitybecomes a per-request opt-out.KeyValueStoreClient.set_recordgains acontent_encodingargument (sync and async). Without it the behavior is barely reachable, as no public resource method took per-request headers.Notes
test_prepare_request_call_keeps_caller_content_encodingcovering their cases plusidentityanddeflate.Content-Encodingpassed to the client constructor counts as caller-supplied on every request, as in JS, where axios config headers include the client defaults.PUTrecord honors the header and serves the record with it) rests on the API docs. The unit tests cover the client side in full.Closes #996
✍️ Drafted by Claude Code