@@ -16,19 +16,24 @@ function LocalBinary(){
16
16
this . is64bits = process . arch == 'x64' ;
17
17
18
18
this . getDownloadPath = function ( ) {
19
+ let sourceURL = 'https://www.browserstack.com/local-testing/downloads/binaries/' ;
20
+ if ( process . env . BROWSERSTACK_LOCAL_BIN_URL ) {
21
+ sourceURL = process . env . BROWSERSTACK_LOCAL_BIN_URL ;
22
+ }
23
+
19
24
if ( this . hostOS . match ( / d a r w i n | m a c o s / i) ) {
20
- return 'https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal-darwin-x64';
25
+ return sourceURL + ' BrowserStackLocal-darwin-x64';
21
26
} else if ( this . hostOS . match ( / m s w i n | m s y s | m i n g w | c y g w i n | b c c w i n | w i n c e | e m c | w i n 3 2 / i) ) {
22
27
this . windows = true ;
23
- return 'https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal.exe';
28
+ return sourceURL + ' BrowserStackLocal.exe';
24
29
} else {
25
30
if ( this . is64bits ) {
26
31
if ( this . isAlpine ( ) )
27
- return 'https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal-alpine';
32
+ return sourceURL + ' BrowserStackLocal-alpine';
28
33
else
29
- return 'https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal-linux-x64';
34
+ return sourceURL + ' BrowserStackLocal-linux-x64';
30
35
} else {
31
- return 'https://www.browserstack.com/local-testing/downloads/binaries/ BrowserStackLocal-linux-ia32';
36
+ return sourceURL + ' BrowserStackLocal-linux-ia32';
32
37
}
33
38
}
34
39
} ;
@@ -140,6 +145,10 @@ function LocalBinary(){
140
145
https . get ( options , function ( response ) {
141
146
const contentEncoding = response . headers [ 'content-encoding' ] ;
142
147
if ( typeof contentEncoding === 'string' && contentEncoding . match ( / g z i p / i) ) {
148
+ if ( process . env . BROWSERSTACK_LOCAL_DEBUG_GZIP ) {
149
+ console . info ( 'using gzip in ' + options . headers [ 'user-agent' ] ) ;
150
+ }
151
+
143
152
response . pipe ( zlib . createGunzip ( ) ) . pipe ( fileStream ) ;
144
153
} else {
145
154
response . pipe ( fileStream ) ;
0 commit comments