Skip to content

fix: Respect caller-supplied Content-Encoding for pre-compressed request bodies - #997

Open
vdusek wants to merge 2 commits into
masterfrom
feat/caller-content-encoding-996
Open

fix: Respect caller-supplied Content-Encoding for pre-compressed request bodies#997
vdusek wants to merge 2 commits into
masterfrom
feat/caller-content-encoding-996

Conversation

@vdusek

@vdusek vdusek commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

A caller-supplied Content-Encoding now 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

  • Precedence in _prepare_request_call: caller Content-Encoding -> content-type heuristic -> size threshold -> compress. The header alone is the "hands off" signal, as in apify-client-js, so no opt-out parameter lands on the public HttpClient ABC. Lookups go through a new case-insensitive _get_header.
  • The header is forwarded verbatim, so encodings the client ships no compressor for (deflate) work too, and identity becomes a per-request opt-out.
  • KeyValueStoreClient.set_record gains a content_encoding argument (sync and async). Without it the behavior is barely reachable, as no public resource method took per-request headers.

Notes

Closes #996

✍️ Drafted by Claude Code

@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Aug 3, 2026
@vdusek vdusek self-assigned this Aug 3, 2026
@github-actions github-actions Bot added this to the 146th sprint - Tooling team milestone Aug 3, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Aug 3, 2026
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.71%. Comparing base (6bd31b2) to head (f981ff2).
⚠️ Report is 1 commits behind head on master.

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     
Flag Coverage Δ
integration 92.05% <70.00%> (-0.28%) ⬇️
unit 84.45% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek requested a review from Mantisus August 3, 2026 16:10
@vdusek
vdusek marked this pull request as ready for review August 3, 2026 16:10
@vdusek
vdusek requested a review from szaganek as a code owner August 3, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support caller-supplied Content-Encoding for pre-compressed request bodies

2 participants