MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / headersWith

Function headersWith

telemetry-dashboard/src/index.ts:68–74  ·  view source on GitHub ↗

* Builds the response headers. Extras go through `new Headers(...)` rather than * an object spread: spreading a `Headers` instance silently yields `{}`, and * losing a `set-cookie` that way would be a very quiet bug.

(defaults: Record<string, string>, extra?: HeadersInit)

Source from the content-addressed store, hash-verified

66 * losing a `set-cookie` that way would be a very quiet bug.
67 */
68function headersWith(defaults: Record<string, string>, extra?: HeadersInit): Headers {
69 const headers = new Headers(defaults);
70 if (extra) {
71 for (const [name, value] of new Headers(extra)) headers.set(name, value);
72 }
73 return headers;
74}
75
76function html(body: string, init: ResponseInit & { nonce?: string } = {}): Response {
77 const { nonce, headers, ...rest } = init;

Callers 3

htmlFunction · 0.85
jsonFunction · 0.85
redirectFunction · 0.85

Calls 1

setMethod · 0.45

Tested by

no test coverage detected