File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 22import { errors } from 'undici' ;
33import type { IncomingHttpHeaders } from 'undici/types/header' ;
44
5+ function isIterable ( value : unknown ) : value is Iterable < unknown > {
6+ return typeof value === 'object' && value != null && Symbol . iterator in value ;
7+ }
8+
59function convertToHeadersObject (
6- _headers : IncomingHttpHeaders | ( string | Buffer ) [ ] | null | undefined ,
10+ _headers :
11+ | IncomingHttpHeaders
12+ | ( string | Buffer ) [ ]
13+ | Iterable < [ string , string | string [ ] | undefined ] >
14+ | null
15+ | undefined ,
716) : IncomingHttpHeaders {
817 const headers : IncomingHttpHeaders = { } ;
918
@@ -27,6 +36,10 @@ function convertToHeadersObject(
2736 }
2837 }
2938 }
39+ } else if ( isIterable ( _headers ) ) {
40+ for ( const [ key , value ] of _headers ) {
41+ headers [ key . toLowerCase ( ) ] = value ;
42+ }
3043 } else if ( _headers != null ) {
3144 for ( const [ key , value ] of Object . entries ( _headers ) ) {
3245 headers [ key . toLowerCase ( ) ] = value ;
You can’t perform that action at this time.
0 commit comments