66
77import { TPromise } from 'vs/base/common/winjs.base' ;
88import { IDisposable } from 'vs/base/common/lifecycle' ;
9+ import { assign } from 'vs/base/common/objects' ;
910import { IRequestOptions , IRequestContext , request } from 'vs/base/node/request' ;
1011import { getProxyAgent } from 'vs/base/node/proxy' ;
1112import { IRequestService , IHTTPConfiguration } from 'vs/platform/request/common/request' ;
@@ -21,6 +22,7 @@ export class RequestService implements IRequestService {
2122
2223 private proxyUrl : string ;
2324 private strictSSL : boolean ;
25+ private authorization : string ;
2426 private disposables : IDisposable [ ] = [ ] ;
2527
2628 constructor (
@@ -37,6 +39,7 @@ export class RequestService implements IRequestService {
3739 private configure ( config : IHTTPConfiguration ) {
3840 this . proxyUrl = config . http && config . http . proxy ;
3941 this . strictSSL = config . http && config . http . proxyStrictSSL ;
42+ this . authorization = config . http && config . http . proxyAuthorization ;
4043 }
4144
4245 request ( options : IRequestOptions ) : TPromise < IRequestContext > {
@@ -45,6 +48,10 @@ export class RequestService implements IRequestService {
4548 options . agent = getProxyAgent ( options . url , { proxyUrl, strictSSL } ) ;
4649 }
4750
51+ if ( this . authorization ) {
52+ options . headers = assign ( options . headers || { } , { 'Proxy-Authorization' : this . authorization } ) ;
53+ }
54+
4855 return request ( options ) ;
4956 }
5057}
0 commit comments