Open
Conversation
cookie headers not handled as string[]
Added support for Multi Headers like cookie
There was a problem hiding this comment.
Pull request overview
Updates the FastEdge test runner and fixtures to preserve multi-valued HTTP headers end-to-end—most importantly Set-Cookie per RFC 6265 §3—across runners, wire protocols (WebSocket/API), frontend rendering, schemas, and test assertions.
Changes:
- Introduces a lossless header projection (
string | string[]) for hook/full-flow results and HTTP-WASM responses (NodeIncomingHttpHeaders-shaped), with supporting helpers (firstValue,flattenToMap). - Fixes fetch-ingestion paths to keep multiple
Set-Cookievalues asstring[]and updates fixtures (Rust/JS/AS) to emit multiple cookies for regression coverage. - Updates tests, JSON schemas, and generated docs to reflect multi-value header semantics and improved type exports.
Reviewed changes
Copilot reviewed 48 out of 48 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test-applications/http-apps/rust/wasi/http-responder/src/lib.rs | Adds a request-triggered branch that emits two Set-Cookie headers for end-to-end regression coverage. |
| test-applications/http-apps/rust/basic/http-responder/src/lib.rs | Same as above for the non-WASI Rust HTTP responder variant. |
| test-applications/http-apps/js/src/http-responder.ts | Emits multiple Set-Cookie values via Headers.append() when x-set-cookies is present. |
| test-applications/cdn-apps/rust/cdn-headers/src/lib.rs | Adds two set-cookie headers and extends expected header assertions accordingly. |
| test-applications/cdn-apps/as/cdn-headers/package.json | Adds build/copy steps for the new headers.wasm target in the AS CDN headers app. |
| test-applications/cdn-apps/as/cdn-headers/assembly/headers.ts | New AS strict header-validation app; adds Set-Cookie multi-value coverage in onResponseHeaders. |
| server/websocket/types.ts | Widens header types in WebSocket payloads to `string |
| server/websocket/StateManager.ts | Updates StateManager emit method signatures to match widened header typing. |
| server/utils/fastedge-cli.ts | Adds TS suppression for import.meta.url under tsc CJS type-checking; minor formatting tweaks. |
| server/test-framework/assertions.ts | Adds case-insensitive header lookup and multi-value matching semantics for assertion helpers. |
| server/runner/types.ts | Introduces HeaderRecord (`Record<string, string |
| server/runner/ProxyWasmRunner.ts | Preserves multiple Set-Cookie values from fetch, flattens request headers for fetch safely, and fixes header-counting to include duplicates. |
| server/runner/PropertyResolver.ts | Stores headers as HeaderRecord and uses firstValue() where property paths require a scalar string. |
| server/runner/IWasmRunner.ts | Types HTTP-WASM HttpResponse.headers as Node IncomingHttpHeaders and documents multi-value semantics. |
| server/runner/IStateManager.ts | Widens header types in runner→state-manager event interfaces. |
| server/runner/HttpWasmRunner.ts | Extracts parseFetchHeaders() to preserve Set-Cookie via getSetCookie(); returns IncomingHttpHeaders. |
| server/runner/HostFunctions.ts | Stores httpCallResponse.headers as tuples to preserve duplicates and converts record/tuples appropriately. |
| server/runner/HeaderManager.ts | Adds firstValue() + flattenToMap(), widens normalization/tuple conversions, and makes tuples→record projection lossless (string[] for multi-values). |
| server/tests/unit/runner/HttpWasmRunner.test.ts | New unit tests for parseFetchHeaders() and multi-value assertion semantics (Set-Cookie). |
| server/tests/unit/runner/HeaderManager.test.ts | Updates tuples→record expectations to preserve multi-values as string[]; adds Set-Cookie-specific test. |
| server/tests/integration/http-apps/http-responder/http-responder.test.ts | Adds integration coverage asserting Set-Cookie remains a string[] across all HTTP-app variants. |
| server/tests/integration/cdn-apps/headers/multi-value-headers.test.ts | Adds integration checks for set-cookie and other duplicated headers being projected as string[]. |
| schemas/http-response.schema.json | Updates schema to reference an IncomingHttpHeaders definition (multi-value Set-Cookie). |
| schemas/hook-result.schema.json | Widens headers schema to string or string[]. |
| schemas/hook-call.schema.json | Widens headers schema to string or string[]. |
| schemas/full-flow-result.schema.json | Widens headers schema to string or string[]. |
| package.json | Adds types conditions to exports for . and ./test to fix TS type resolution. |
| frontend/src/types/index.ts | Widens header types in frontend DTOs to `string |
| frontend/src/stores/types.ts | Widens HTTP-WASM response headers to allow `string |
| frontend/src/hooks/websocket-types.ts | Mirrors backend WebSocket header typing changes. |
| frontend/src/components/proxy-wasm/HookStagesPanel/HookStagesPanel.tsx | Handles multi-valued content-type by reading the first value. |
| frontend/src/components/common/ResponsePanel/ResponsePanel.tsx | Renders multi-valued headers as one row per value for readability. |
| frontend/src/api/index.ts | Updates API typing for full-flow and HTTP-WASM execute responses to support multi-valued headers. |
| frontend/src/App.tsx | Flattens any multi-valued headers to comma-joined strings for the editable request-headers UI field. |
| esbuild/bundle-lib.js | Writes a top-level dist/lib/index.d.ts shim to re-export runner entry types for root import typing. |
| docs/WEBSOCKET.md | Documents widened wire header value types (`string |
| docs/TEST_FRAMEWORK.md | Updates documented header/result types and assertion helper semantics for multi-value headers. |
| docs/TEST_CONFIG.md | Formatting/spacing updates in generated documentation tables. |
| docs/RUNNER.md | Updates docs to reflect IncomingHttpHeaders and multi-valued Set-Cookie handling. |
| docs/INDEX.md | Updates exported API list formatting in generated docs. |
| docs/DEBUGGER.md | Updates generated debugger docs (env var table changed). |
| docs/API.md | Notes widened output header shape (`string |
| context/features/MULTI_VALUE_HEADERS.md | Expands/refreshes design notes: three header layers, Set-Cookie correctness, and in-repo AS port details. |
| context/features/CROSS_PLATFORM.md | Updates documented port probing range (5179–5228). |
| context/architecture/BACKEND_ARCHITECTURE.md | Documents the three header type layers and how they flow through the backend. |
| context/VSCODE_BUNDLING.md | Updates documented port probing range (5179–5228). |
| context/CONTEXT_INDEX.md | Updates index to reflect the expanded port probing range and refreshed multi-value header doc summary. |
| context/CHANGELOG.md | Adds a detailed changelog entry for Set-Cookie/multi-value header preservation and type export fixes. |
Removed "OPTIONS" from cdn debugger methods
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 79 out of 80 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
frontend/src/hooks/websocket-types.ts:101
HttpWasmRequestCompletedEvent.data.response.contentTypeis typed asstringhere, but the backend event type (server/websocket/types.ts) andIWasmRunner.HttpResponseallowstring | null. To keep the frontend WebSocket types truly mirroring the backend (and avoid runtime surprises if a null content-type is ever emitted), widen this tostring | null(or normalize to "" on the server before broadcasting and document that invariant).
response: {
status: number;
statusText: string;
headers: Record<string, string | string[] | undefined>;
body: string;
contentType: string;
isBase64?: boolean;
};
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.