File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ class HeadersList {
95
95
clear ( ) {
96
96
this [ kHeadersMap ] . clear ( )
97
97
this [ kHeadersSortedMap ] = null
98
+ this . cookies = null
98
99
}
99
100
100
101
// https://fetch.spec.whatwg.org/#concept-header-list-append
Original file line number Diff line number Diff line change @@ -460,3 +460,19 @@ test('constructing Request with third party FormData body', async (t) => {
460
460
t . equal ( contentType [ 0 ] , 'multipart/form-data; boundary' )
461
461
t . ok ( ( await req . text ( ) ) . startsWith ( `--${ contentType [ 1 ] } ` ) )
462
462
} )
463
+
464
+ // https://github.com/nodejs/undici/issues/2050
465
+ test ( 'set-cookie headers get cleared when passing a Request as first param' , ( t ) => {
466
+ const req1 = new Request ( 'http://localhost' , {
467
+ headers : {
468
+ 'set-cookie' : 'a=1'
469
+ }
470
+ } )
471
+
472
+ t . same ( [ ...req1 . headers ] , [ [ 'set-cookie' , 'a=1' ] ] )
473
+ const req2 = new Request ( req1 , { headers : { } } )
474
+
475
+ t . same ( [ ...req2 . headers ] , [ ] )
476
+ t . same ( req2 . headers . getSetCookie ( ) , [ ] )
477
+ t . end ( )
478
+ } )
You can’t perform that action at this time.
0 commit comments