MCPcopy Index your code
hub / github.com/coder/mux / getFirstHeaderValue

Function getFirstHeaderValue

src/node/orpc/authMiddleware.ts:38–50  ·  view source on GitHub ↗
(
  headers: IncomingHttpHeaders | undefined,
  key: string
)

Source from the content-addressed store, hash-verified

36}
37
38export function getFirstHeaderValue(
39 headers: IncomingHttpHeaders | undefined,
40 key: string
41): string | undefined {
42 const raw = headers?.[key];
43 const value = Array.isArray(raw) ? raw[0] : raw;
44 if (typeof value !== "string") {
45 return undefined;
46 }
47
48 const trimmed = value.trim();
49 return trimmed.length > 0 ? trimmed : undefined;
50}
51
52export function extractClientIpAddress(
53 headers: IncomingHttpHeaders | undefined

Callers 3

extractClientIpAddressFunction · 0.70
createAuthMiddlewareFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected