Commit a3566b6
committed
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#2521 parent 23312e7 commit a3566b6
File tree
4 files changed
+93
-26
lines changed- gateway
4 files changed
+93
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
578 | 600 | | |
579 | 601 | | |
580 | 602 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
665 | 665 | | |
666 | 666 | | |
667 | 667 | | |
668 | | - | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
669 | 679 | | |
670 | | - | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
671 | 690 | | |
672 | 691 | | |
673 | 692 | | |
674 | 693 | | |
675 | 694 | | |
676 | 695 | | |
| 696 | + | |
| 697 | + | |
677 | 698 | | |
678 | 699 | | |
679 | 700 | | |
| |||
687 | 708 | | |
688 | 709 | | |
689 | 710 | | |
690 | | - | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
691 | 714 | | |
692 | 715 | | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
693 | 719 | | |
694 | 720 | | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
699 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
700 | 737 | | |
701 | 738 | | |
702 | 739 | | |
| |||
716 | 753 | | |
717 | 754 | | |
718 | 755 | | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
723 | 759 | | |
724 | 760 | | |
725 | 761 | | |
| |||
736 | 772 | | |
737 | 773 | | |
738 | 774 | | |
739 | | - | |
| 775 | + | |
| 776 | + | |
740 | 777 | | |
741 | | - | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
742 | 782 | | |
743 | 783 | | |
744 | 784 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
99 | 104 | | |
100 | 105 | | |
101 | 106 | | |
| |||
0 commit comments