upstream-response-headers.mjs
sha256:c2dbf04d56308f3bbf2d06e6d2eb022b8948b1e827195fe525a44e5e18d5f9c0
feat(auth): Phase B Connect cloud agent (RFC 8628) + Hermes…
Human
minor
⚠ breaking
12 days ago
| 1 | /** |
| 2 | * When the gateway proxies with fetch().text(), the body is already decoded. |
| 3 | * Forwarding upstream Content-Encoding (e.g. br) causes browsers to ERR_CONTENT_DECODING_FAILED. |
| 4 | */ |
| 5 | |
| 6 | const STRIP_FROM_UPSTREAM_DECODED_BODY = new Set([ |
| 7 | 'content-encoding', |
| 8 | 'content-length', |
| 9 | 'transfer-encoding', |
| 10 | 'connection', |
| 11 | 'access-control-allow-origin', |
| 12 | 'access-control-allow-methods', |
| 13 | 'access-control-allow-headers', |
| 14 | 'access-control-allow-credentials', |
| 15 | 'access-control-expose-headers', |
| 16 | 'access-control-max-age', |
| 17 | ]); |
| 18 | |
| 19 | /** |
| 20 | * @param {Iterable<[string, string]>} entries - upstream Response.headers entries |
| 21 | * @returns {[string, string][]} |
| 22 | */ |
| 23 | export function filterUpstreamResponseHeadersForDecodedBody(entries) { |
| 24 | return [...entries].filter(([k]) => !STRIP_FROM_UPSTREAM_DECODED_BODY.has(k.toLowerCase())); |
| 25 | } |
File History
1 commit
sha256:93bcf8f9bd56d8c5b9339f4ec73b9ebd66571398d56262d38eedc2cfa9db9882
fix(test): align Band B landing assertion with desktop MCP …
Human
12 days ago