fix(extension): keep empty response header values on HTTP/2
why
Fixes #3421.
Over HTTP/2, a response header sent with an empty value disappears from response.headersArray(). headerValue() then returns null and headerValues() returns [], even though headers() and allHeaders() report the header as "" on the same response. Over HTTP/1.1 all of them agree.
what changed
splitHeaderValues()inpackages/extension/understudy/response.tsno longer filters out empty values. That was the only place the value was lost:headersArray()falls back to the header map when Chrome sends no raw header text, which is the case for HTTP/2.- Two regression tests in
packages/extension/tests/response-rpc.test.ts:- one drives
response.headers_arraythrough the RPC router for a header map with an empty value, before and after extra info arrives and next to a duplicated header; - one asserts the header-map path and the raw-text path report the same entries.
- one drives
- Patch changeset for the extension and the TypeScript and Python SDKs, as other extension-only fixes use.
No protocol or SDK code changes. Both SDKs already return "" for a present empty value once the runtime includes it in response.headers_array.
test plan
vitest run packages/extension/tests packages/extension/understudy: 73 files, 1190 tests pass. Both new tests fail without the source change.tsc --noEmit -p packages/extension/tsconfig.json, plusoxfmt --checkandoxlinton the changed files: clean.- Manual check against Chrome 156 with the
node:http2fixture from the issue. Before:headerValue('x-empty')isnulland the header is missing fromheadersArray(). After:""and present, matching HTTP/1.1. packages/sdk-ts/tests/integration/pageGotoResponse.test.tsstill passes against the rebuilt extension.- Not run: the Python and Go checks, since I don't have
uvorgoinstalled. The change touches no generated code and no protocol schema.
One note for whoever runs just check: scripts/release/check-changesets.ts currently fails on main because of agent-discoverability-metadata.md. The changeset added here validates on its own.
Summary by cubic
Fixes HTTP/2 responses dropping headers sent with an empty value from headersArray(), which made headerValue() return null and headerValues() return [] even though headers() reported the header as "". HTTP/1.1 responses already reported the header consistently across all methods.
- Removes the empty-value filter in
splitHeaderValues(), the only place the value was lost when Chrome sends no raw header text. - Adds regression tests covering header-map entries with empty values, extra-info arrivals, duplicated headers, and parity between the header-map and raw-text paths.
- Adds patch changesets for the extension, TypeScript SDK, and Python SDK.