(headers)
| 18 | |
| 19 | // Convert an undici request headers array to a plain object (Map<string, string>) |
| 20 | function requestHeadersArrayToDictionary(headers) { |
| 21 | const dict = {}; |
| 22 | let charset; |
| 23 | let mimeType; |
| 24 | for (let idx = 0; idx < headers.length; idx += 2) { |
| 25 | const key = `${headers[idx]}`; |
| 26 | const value = `${headers[idx + 1]}`; |
| 27 | dict[key] = value; |
| 28 | |
| 29 | if (StringPrototypeToLowerCase(key) === 'content-type') { |
| 30 | const result = sniffMimeType(value); |
| 31 | charset = result.charset; |
| 32 | mimeType = result.mimeType; |
| 33 | } |
| 34 | } |
| 35 | return [dict, charset, mimeType]; |
| 36 | }; |
| 37 | |
| 38 | // Convert an undici response headers array to a plain object (Map<string, string>) |
| 39 | function responseHeadersArrayToDictionary(headers) { |
no test coverage detected