* Converts an array of raw headers to an object, using the same rules as Nodes `http.IncomingMessage.headers`. * * Header names/keys are lower-cased.
(rawHeaders)
| 190 | * Header names/keys are lower-cased. |
| 191 | */ |
| 192 | function headersArrayToObject(rawHeaders) { |
| 193 | if (!Array.isArray(rawHeaders)) { |
| 194 | throw Error('Expected a header array') |
| 195 | } |
| 196 | |
| 197 | const accumulator = {} |
| 198 | |
| 199 | forEachHeader(rawHeaders, (value, fieldName) => { |
| 200 | addHeaderLine(accumulator, fieldName, value) |
| 201 | }) |
| 202 | |
| 203 | return accumulator |
| 204 | } |
| 205 | |
| 206 | const noDuplicatesHeaders = new Set([ |
| 207 | 'age', |
nothing calls this directly
no test coverage detected