MCPcopy Create free account
hub / github.com/nodejs/node / withHostHeader

Function withHostHeader

deps/undici/src/lib/interceptor/dns.js:86–105  ·  view source on GitHub ↗
(host, headers)

Source from the content-addressed store, hash-verified

84}
85
86function withHostHeader (host, headers) {
87 const normalizedHeaders = normalizeHeaders(headers)
88
89 if (hasHostHeader(normalizedHeaders)) {
90 return normalizedHeaders
91 }
92
93 if (Array.isArray(normalizedHeaders)) {
94 return ['host', host, ...normalizedHeaders]
95 }
96
97 if (normalizedHeaders && typeof normalizedHeaders === 'object') {
98 return {
99 host,
100 ...normalizedHeaders
101 }
102 }
103
104 return { host }
105}
106
107class DNSStorage {
108 #maxItems = 0

Callers 2

onResponseErrorMethod · 0.85
dns.jsFile · 0.85

Calls 2

hasHostHeaderFunction · 0.85
normalizeHeadersFunction · 0.70

Tested by

no test coverage detected