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

Function hasHostHeader

deps/undici/src/lib/interceptor/dns.js:56–84  ·  view source on GitHub ↗
(headers)

Source from the content-addressed store, hash-verified

54}
55
56function hasHostHeader (headers) {
57 if (headers == null) {
58 return false
59 }
60
61 if (Array.isArray(headers)) {
62 if (headers.length === 0) {
63 return false
64 }
65
66 for (let i = 0; i < headers.length; i += 2) {
67 if (isHostHeader(headers[i])) {
68 return true
69 }
70 }
71
72 return false
73 }
74
75 if (typeof headers === 'object') {
76 for (const key in headers) {
77 if (isHostHeader(key)) {
78 return true
79 }
80 }
81 }
82
83 return false
84}
85
86function withHostHeader (host, headers) {
87 const normalizedHeaders = normalizeHeaders(headers)

Callers 1

withHostHeaderFunction · 0.85

Calls 1

isHostHeaderFunction · 0.85

Tested by

no test coverage detected