-
Notifications
You must be signed in to change notification settings - Fork 143
feat(gateway): IPIP-523 format query over Accept header #1074
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
base: main
Are you sure you want to change the base?
Conversation
…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
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #1074 +/- ##
==========================================
+ Coverage 61.10% 61.14% +0.03%
==========================================
Files 264 264
Lines 26215 26231 +16
==========================================
+ Hits 16019 16039 +20
+ Misses 8519 8516 -3
+ Partials 1677 1676 -1
... and 9 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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
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.
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
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.
CI with end-to-end tests at
are green.
AFAIK this PR is a low risk change (see Compatibility section in IPIP-523)
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 commingle different response types under the same cache key.the only breaking change is for edge cases where a client sends both a specific
Acceptheader and a different?format=value. previouslyAcceptwould win, now?format=wins. this scenario is rare and arguably represents client misconfiguration. when detected, gateway returns HTTP 400 to signal the ambiguity.TODO