-
Notifications
You must be signed in to change notification settings - Fork 15
test!(ipip-523/v0.9): prefer format query param over accept header #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When both are present, allow the query param to override the accept header
|
Results against Kubo latest: Summary
|
|
Results against Kubo master: Important See the action summary for full results. This PR cannot be merged until there is a Kubo PR that uses tests from this branch and passes CI. Link related PRs (boxo, kubo) in the PR description. Summary
|
BREAKING CHANGE: these tests expect URL query parameters to take precedence over Accept header, which reverses the previous behavior. adds tests verifying URL query parameters take precedence over Accept header: - TestTrustlessCarFormatPrecedence: format=car/raw overrides Accept header - TestTrustlessCarParamPrecedence: car-order and car-dups override Accept params - moves "format=car respects Accept header CAR params" test to param precedence - updates hint in existing JSON format precedence test
When testing against Kubo master, display a note in job summary and PR comment explaining that failing tests require a companion Kubo PR that uses tests from this branch and passes CI.
…pt header this change simplifies precedence rules by making the ?format= URL query parameter always take priority over the Accept HTTP header when both are present. in practice, this is largely compatible with existing browser use cases since browsers send Accept headers with wildcards which were already treated as non-specific. prioritizing ?format= also ensures deterministic HTTP caching behavior, protecting against CDNs that comingle different response types under the same cache key. the only breaking change is for edge cases where a client sends both a specific Accept header and a different ?format= value. previously Accept would win, now ?format= wins. this scenario is rare and arguably represents client misconfiguration. when detected, gateway returns HTTP 400 to signal the ambiguity. specs: ipfs/specs#523 tests: ipfs/gateway-conformance#252
update boxo to ipfs/boxo#1074 and gateway-conformance tests to ipfs/gateway-conformance#252 for testing IPIP-523 changes where ?format= URL query parameter takes precedence over Accept HTTP header
update boxo to ipfs/boxo#1074 and gateway-conformance tests to ipfs/gateway-conformance#252 for testing IPIP-523 changes where ?format= URL query parameter takes precedence over Accept HTTP header
update boxo to ipfs/boxo#1074 and gateway-conformance tests to ipfs/gateway-conformance#252 for testing IPIP-523 changes where ?format= URL query parameter takes precedence over Accept HTTP header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I've added a few more tests and implemented the IPIP-523 in:
- ipfs/boxo#1074
- ipfs/kubo#11086 (this is where we use everything end-to-end and want CI to be green – and it is!)
and works as expected.
If no concerns I'm going to release this later this week after I finish reviewing other IPIPs.
`car-order` and `car-dups` URL params depend on optional `order`/`dups` support from IPIP-412, matching `TestTrustlessCarOrderAndDuplicates`. Merged tests into `TestTrustlessCarOrderAndDuplicates` to keep all optional order/dups tests together.
temporary switch to ipfs/gateway-conformance#252
lidel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to tag a release with this shortly.
…ferring-format-over-accept
7f13643 to
222c941
Compare
222c941 to
cd68d00
Compare
* feat(gateway): IPIP-523 format query param takes precedence over Accept header this change simplifies precedence rules by making the ?format= URL query parameter always take priority over the Accept HTTP header when both are present. in practice, this is largely compatible with existing browser use cases since browsers send Accept headers with wildcards which were already treated as non-specific. prioritizing ?format= also ensures deterministic HTTP caching behavior, protecting against CDNs that comingle different response types under the same cache key. the only breaking change is for edge cases where a client sends both a specific Accept header and a different ?format= value. previously Accept would win, now ?format= wins. this scenario is rare and arguably represents client misconfiguration. when detected, gateway returns HTTP 400 to signal the ambiguity. specs: ipfs/specs#523 tests: ipfs/gateway-conformance#252 * docs(changelog): add IPIP-523 to unreleased * fix(gateway): IPIP-523 ?format always wins over Accept header remove HTTP 400 error for conflicting ?format and Accept values. instead, ?format silently takes precedence, which is simpler and less breaking for browser clients that send Accept headers automatically. * ci: use gateway-conformance with IPIP-523 tests temporary switch to ipfs/gateway-conformance#252 * chore(ci): switch to gateway-conformance@v0.9
* test: IPIP-523 format query precedence over Accept header update boxo to ipfs/boxo#1074 and gateway-conformance tests to ipfs/gateway-conformance#252 for testing IPIP-523 changes where ?format= URL query parameter takes precedence over Accept HTTP header * chore: update boxo and gateway-conformance for IPIP-523 testing - boxo@9aeb0c835899fedb4f886040a4ccf3ba09fd97d4 - gateway-conformance@c82a2a9bc79303e0f07216a80cf454ef2a1e042c * chore(ci): switch to gateway-conformance@v0.9 * chore: update boxo with IPIP-523 changes * chore: update boxo to main after ipfs/boxo#1074 merge * docs: add gateway-conformance v0.9 to changelog
When both are present, allow the query param to override the accept header.
BREAKING CHANGE: these tests expect URL query parameters to take precedence over Accept header, which reverses the previous behavior, needs to be released as minor release.