File tree Expand file tree Collapse file tree 1 file changed +20
-19
lines changed Expand file tree Collapse file tree 1 file changed +20
-19
lines changed Original file line number Diff line number Diff line change @@ -51,23 +51,24 @@ export default HeadersPolyfill;
51
51
* @param {import('http').IncomingMessage['rawHeaders'] } headers
52
52
*/
53
53
export function fromRawHeaders ( headers = [ ] ) {
54
- let init = headers
55
- // Split into pairs
56
- . reduce ( ( result , _ , index , array ) => {
57
- if ( index % 2 === 0 ) {
58
- let [ k , v ] = array . slice ( index , index + 2 ) ;
59
- result . push ( [ k , v ] ) ;
60
- }
61
- return result ;
62
- } , /** @type {[string, string][] } */ ( [ ] ) )
63
- . filter ( ( [ name , value ] ) => {
64
- try {
65
- validateHeaderName ( name ) ;
66
- validateHeaderValue ( name , String ( value ) ) ;
67
- return true ;
68
- } catch {
69
- return false ;
70
- }
71
- } ) ;
72
- return new HeadersPolyfill ( init ) ;
54
+ return new HeadersPolyfill (
55
+ headers
56
+ // Split into pairs
57
+ . reduce ( ( result , value , index , array ) => {
58
+ if ( index % 2 === 0 ) {
59
+ let [ k , v ] = array . slice ( index , index + 2 ) ;
60
+ result . push ( [ k , v ] ) ;
61
+ }
62
+ return result ;
63
+ } , /** @type {[string, string][] } */ ( [ ] ) )
64
+ . filter ( ( [ name , value ] ) => {
65
+ try {
66
+ validateHeaderName ( name ) ;
67
+ validateHeaderValue ( name , String ( value ) ) ;
68
+ return true ;
69
+ } catch {
70
+ return false ;
71
+ }
72
+ } )
73
+ ) ;
73
74
}
You can’t perform that action at this time.
0 commit comments