File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import { getBasicAuthorizationHeader } from './utils/get_basic';
13
13
14
14
interface Options {
15
15
method : string ;
16
- headers : string [ ] ;
16
+ headers : Record < string , string > ;
17
17
path ?: string ;
18
18
localAddress ?: string ;
19
19
family ?: number ;
@@ -71,25 +71,24 @@ export const chain = (
71
71
const options : Options = {
72
72
method : 'CONNECT' ,
73
73
path : request . url ,
74
- headers : [
75
- 'host' ,
76
- request . url ! ,
77
- ] ,
74
+ headers : {
75
+ host : request . url ! ,
76
+ } ,
78
77
localAddress : handlerOpts . localAddress ,
79
78
family : handlerOpts . ipFamily ,
80
79
lookup : handlerOpts . dnsLookup ,
81
80
} ;
82
81
83
82
if ( proxy . username || proxy . password ) {
84
- options . headers . push ( 'proxy-authorization' , getBasicAuthorizationHeader ( proxy ) ) ;
83
+ options . headers [ 'proxy-authorization' ] = getBasicAuthorizationHeader ( proxy ) ;
85
84
}
86
85
87
86
const client = proxy . protocol === 'https:'
88
87
? https . request ( proxy . origin , {
89
- ...options as unknown as https . RequestOptions ,
88
+ ...options ,
90
89
rejectUnauthorized : ! handlerOpts . ignoreUpstreamProxyCertificate ,
91
90
} )
92
- : http . request ( proxy . origin , options as unknown as http . RequestOptions ) ;
91
+ : http . request ( proxy . origin , options ) ;
93
92
94
93
client . once ( 'socket' , ( targetSocket : SocketWithPreviousStats ) => {
95
94
// Socket can be re-used by multiple requests.
You can’t perform that action at this time.
0 commit comments