MCPcopy Create free account
hub / github.com/Noumena-Network/code / getHeaderValue

Function getHeaderValue

src/utils/teleport/environments.test.ts:51–70  ·  view source on GitHub ↗
(
  headers: unknown,
  key: string,
)

Source from the content-addressed store, hash-verified

49const liveServers: MockOauthServer[] = []
50
51function getHeaderValue(
52 headers: unknown,
53 key: string,
54): string | undefined {
55 if (!headers || typeof headers !== 'object') {
56 return undefined
57 }
58
59 const direct = (headers as Record<string, string | undefined>)[key]
60 if (typeof direct === 'string') {
61 return direct
62 }
63
64 const getter = (headers as { get?: (name: string) => string | undefined }).get
65 if (typeof getter === 'function') {
66 return getter.call(headers, key)
67 }
68
69 return undefined
70}
71
72function restoreEnv(): void {
73 for (const key of envKeys) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected