Skip to content

Draft: Fix #2155 - Streaming gzipped responses#7252

Draft
ReadingNought wants to merge 1 commit intopsf:mainfrom
ReadingNought:fix/issue-2155-streaming-gzipped-responses
Draft

Draft: Fix #2155 - Streaming gzipped responses#7252
ReadingNought wants to merge 1 commit intopsf:mainfrom
ReadingNought:fix/issue-2155-streaming-gzipped-responses

Conversation

@ReadingNought
Copy link

Summary

Enable automatic content decoding on Response.raw so streamed gzip-encoded responses can be consumed directly via file-like readers.

Root Cause

Requests built responses with raw.decode_content=False, so consumers reading from response.raw got compressed bytes by default. This breaks file-like streaming parsers that call .read() and expect decoded content.

Changes Made

  • Set response.raw.decode_content = True in HTTPAdapter.build_response.
  • Added a regression test in tests/test_adapters.py to verify build_response enables decoded raw reads by default.

Verification

  • Ran: PYTHONPATH=src pytest -q tests/test_adapters.py
  • Result: 2 passed

Notes

  • Explicit reads that need wire-level compressed bytes can still request decode_content=False on read/stream calls.

Closes #2155

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.

Streaming gzipped responses

1 participant