File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
lib/connection/connections Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -82,14 +82,11 @@ export default class HttpConnection implements IConnectionProvider {
82
82
: '' ;
83
83
const proxyUrl = `${ proxyOptions . protocol } ://${ proxyAuth } ${ proxyOptions . host } :${ proxyOptions . port } ` ;
84
84
85
- const proxyProtocol = `${ proxyOptions . protocol } :` ;
86
-
87
85
return new ProxyAgent ( {
88
86
...this . getAgentDefaultOptions ( ) ,
89
87
getProxyForUrl : ( ) => proxyUrl ,
90
88
httpsAgent : this . createHttpsAgent ( ) ,
91
89
httpAgent : this . createHttpAgent ( ) ,
92
- protocol : proxyProtocol ,
93
90
} ) ;
94
91
}
95
92
Original file line number Diff line number Diff line change @@ -50,6 +50,17 @@ describe('Proxy', () => {
50
50
const proxy = new HttpProxyMock ( `https://${ config . host } ` , 9090 ) ;
51
51
try {
52
52
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
+
53
64
const clientConfig = client . getConfig ( ) ;
54
65
sinon . stub ( client , 'getConfig' ) . returns ( clientConfig ) ;
55
66
You can’t perform that action at this time.
0 commit comments