File tree Expand file tree Collapse file tree
lib/connection/connections Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,14 +82,11 @@ export default class HttpConnection implements IConnectionProvider {
8282 : '' ;
8383 const proxyUrl = `${ proxyOptions . protocol } ://${ proxyAuth } ${ proxyOptions . host } :${ proxyOptions . port } ` ;
8484
85- const proxyProtocol = `${ proxyOptions . protocol } :` ;
86-
8785 return new ProxyAgent ( {
8886 ...this . getAgentDefaultOptions ( ) ,
8987 getProxyForUrl : ( ) => proxyUrl ,
9088 httpsAgent : this . createHttpsAgent ( ) ,
9189 httpAgent : this . createHttpAgent ( ) ,
92- protocol : proxyProtocol ,
9390 } ) ;
9491 }
9592
Original file line number Diff line number Diff line change @@ -50,6 +50,17 @@ describe('Proxy', () => {
5050 const proxy = new HttpProxyMock ( `https://${ config . host } ` , 9090 ) ;
5151 try {
5252 const client = new DBSQLClient ( ) ;
53+
54+ // Our proxy mock is HTTP -> HTTPS, but DBSQLClient is hard-coded to use HTTPS.
55+ // Here we override default behavior to make DBSQLClient work with HTTP proxy
56+ const originalGetConnectionOptions = client . getConnectionOptions ;
57+ client . getConnectionOptions = ( ...args ) => {
58+ const result = originalGetConnectionOptions . apply ( client , args ) ;
59+ result . https = false ;
60+ result . port = 80 ;
61+ return result ;
62+ } ;
63+
5364 const clientConfig = client . getConfig ( ) ;
5465 sinon . stub ( client , 'getConfig' ) . returns ( clientConfig ) ;
5566
You can’t perform that action at this time.
0 commit comments