MCPcopy
hub / github.com/nodejs/undici / normalizeStripHeaders

Function normalizeStripHeaders

lib/handler/redirect-handler.js:176–194  ·  view source on GitHub ↗
(headers, optionName)

Source from the content-addressed store, hash-verified

174
175// https://tools.ietf.org/html/rfc7231#section-6.4
176function normalizeStripHeaders (headers, optionName) {
177 if (headers == null) {
178 return null
179 }
180
181 if (!Array.isArray(headers)) {
182 throw new InvalidArgumentError(`${optionName} must be an array`)
183 }
184
185 const normalized = new Set()
186 for (const header of headers) {
187 if (typeof header !== 'string') {
188 throw new InvalidArgumentError(`${optionName} must contain header names`)
189 }
190
191 normalized.add(util.headerNameToString(header))
192 }
193 return normalized
194}
195
196function cleanRequestHeaders (headers, removeContent, unknownOrigin, stripHeaders, stripHeadersOnCrossOrigin) {
197 const ret = []

Callers 1

constructorMethod · 0.85

Calls 1

addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…