Repository navigation
test(contract): expect Content-Encoding among the exposed headers - #12
Merged
Merged
Conversation
The public gateway lists Content-Encoding in Access-Control-Expose-Headers (decdn/decdn#2817), so a page on another origin can tell a body was decoded on the way. The fake mirrors the list and the public contract asserts it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
Two active review nits remain in the test suite—one requesting a more accurate test name in tests/contract/test_public.py and another to remove a duplicated EXPOSED constant in tests/unit/test_fake_gateway.py by importing it from tests.fake_gateway to prevent drift.
2 open issues
What changed in this PR
Aligns the fake gateway and public contract tests with the gateway behavior that exposes Content-Encoding via CORS so cross-origin callers can detect response encoding.
Changes:
- Add
Content-Encodingto the fake gateway’sAccess-Control-Expose-Headerslist (matching gateway ordering). - Update unit expectations for the exposed-headers list.
- Add a contract assertion that cross-origin blob reads observe
content-encoding(andcontent-length) inaccess-control-expose-headers.
| File | Description |
|---|---|
| tests/unit/test_fake_gateway.py | Updates unit test expectations around the fake gateway’s exposed CORS headers to include Content-Encoding. |
| tests/fake_gateway.py | Adjusts the fake gateway’s Access-Control-Expose-Headers list to expose Content-Encoding in the intended order. |
| tests/contract/test_public.py | Adds a public contract test asserting access-control-expose-headers includes content-encoding and content-length for cross-origin requests. |
Review effort: Balanced
scripts/decdn-contract.sh --tag names its release in DECDN_CONTRACT_RELEASE, and shipped_after(version) in the fixture gates a contract test on it. The test is declared only when the gateway carries the behaviour, since decdn's harness fails a run that skips a test. The Content-Encoding expose test runs on gateways after v0.3.1, the fake and every --ref run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… plainly Co-Authored-By: Claude Opus 5.5 <[email protected]>
alpergundogdu
added a commit
to decdn/decdn
that referenced
this pull request
Nov 13, 2026
decdn/sdk-typescript#25 and decdn/sdk-python#12 squash-merged, so the pins move from the PR branch heads to the commits on each SDK's main. The trees are identical. Co-authored-by: Claude Fable 5.2 <[email protected]>
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.

The public gateway adds
Content-EncodingtoAccess-Control-Expose-Headers(decdn/decdn#2817, gateway change in decdn/decdn#2870), so a page on another origin can tell that a proxy in front encoded the body.Changes
tests/fake_gateway.pyandtests/unit/test_fake_gateway.py:EXPOSEDlistsContent-EncodingafterContent-Length, as the gateway does.tests/contract/test_public.py: a blob read with anOriginfindscontent-encodingandcontent-lengthinaccess-control-expose-headers.tests/contract/fixture.py:shipped_after(version)says whether the gateway under test carries behaviour decdn shipped after that release.scripts/decdn-contract.sh --tagsetsDECDN_CONTRACT_RELEASE; the fake and--refruns carry everything.if shipped_after("0.3.1"):. It is left out, not skipped, because decdn's harness fails a run where any collected test is skipped. CONTRIBUTING.md describes the pattern. This is the same gate as test(contract): expect Content-Encoding among the exposed headers sdk-typescript#25.Order
This PR merges first. decdn/decdn#2870 pins
.github/sdk-python.shato this branch's head.Gateway floor
gateway-floorstays as is: the SDK code does not change, and the weekly release-gateway runs do not collect the new test.Tests
uv run ruff check .,uv run ruff format --check .,uv run mypy,shellcheck scripts/decdn-contract.sh: pass.uv run pytest tests/unit tests/contract: 354 passed.DECDN_CONTRACT_RELEASE=0.3.1the new test is not collected; with 0.3.2 or 0.4.0-rc.1 it runs and passes.tests/scripts/test_decdn_contract.pyfails locally on macOS, unrelated to this change.🤖 Generated with Claude Code