File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1203,6 +1203,9 @@ function httpRedirectFetch (fetchParams, response) {
12031203 // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
12041204 request . headersList . delete ( 'authorization' )
12051205
1206+ // https://fetch.spec.whatwg.org/#authentication-entries
1207+ request . headersList . delete ( 'proxy-authorization' , true )
1208+
12061209 // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
12071210 request . headersList . delete ( 'cookie' )
12081211 request . headersList . delete ( 'host' )
Original file line number Diff line number Diff line change @@ -6,11 +6,12 @@ const { once } = require('events')
66const { fetch } = require ( '../..' )
77
88test ( 'Cross-origin redirects clear forbidden headers' , async ( t ) => {
9- t . plan ( 5 )
9+ t . plan ( 6 )
1010
1111 const server1 = createServer ( ( req , res ) => {
1212 t . equal ( req . headers . cookie , undefined )
1313 t . equal ( req . headers . authorization , undefined )
14+ t . equal ( req . headers [ 'proxy-authorization' ] , undefined )
1415
1516 res . end ( 'redirected' )
1617 } ) . listen ( 0 )
@@ -39,7 +40,8 @@ test('Cross-origin redirects clear forbidden headers', async (t) => {
3940 const res = await fetch ( `http://localhost:${ server2 . address ( ) . port } ` , {
4041 headers : {
4142 Authorization : 'test' ,
42- Cookie : 'ddd=dddd'
43+ Cookie : 'ddd=dddd' ,
44+ 'Proxy-Authorization' : 'test'
4345 }
4446 } )
4547
You can’t perform that action at this time.
0 commit comments