Skip to content

Commit 312c566

Browse files
committed
chore: apply sourceURL override, log line for debugging
1 parent 27065e3 commit 312c566

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

lib/LocalBinary.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,24 @@ function LocalBinary(){
1616
this.is64bits = process.arch == 'x64';
1717

1818
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+
1924
if(this.hostOS.match(/darwin|mac os/i)){
20-
return 'https://www.browserstack.com/local-testing/downloads/binaries/BrowserStackLocal-darwin-x64';
25+
return sourceURL + 'BrowserStackLocal-darwin-x64';
2126
} else if(this.hostOS.match(/mswin|msys|mingw|cygwin|bccwin|wince|emc|win32/i)) {
2227
this.windows = true;
23-
return 'https://www.browserstack.com/local-testing/downloads/binaries/BrowserStackLocal.exe';
28+
return sourceURL + 'BrowserStackLocal.exe';
2429
} else {
2530
if(this.is64bits) {
2631
if(this.isAlpine())
27-
return 'https://www.browserstack.com/local-testing/downloads/binaries/BrowserStackLocal-alpine';
32+
return sourceURL + 'BrowserStackLocal-alpine';
2833
else
29-
return 'https://www.browserstack.com/local-testing/downloads/binaries/BrowserStackLocal-linux-x64';
34+
return sourceURL + 'BrowserStackLocal-linux-x64';
3035
} else {
31-
return 'https://www.browserstack.com/local-testing/downloads/binaries/BrowserStackLocal-linux-ia32';
36+
return sourceURL + 'BrowserStackLocal-linux-ia32';
3237
}
3338
}
3439
};
@@ -140,6 +145,10 @@ function LocalBinary(){
140145
https.get(options, function (response) {
141146
const contentEncoding = response.headers['content-encoding'];
142147
if (typeof contentEncoding === 'string' && contentEncoding.match(/gzip/i)) {
148+
if (process.env.BROWSERSTACK_LOCAL_DEBUG_GZIP) {
149+
console.info('using gzip in ' + options.headers['user-agent']);
150+
}
151+
143152
response.pipe(zlib.createGunzip()).pipe(fileStream);
144153
} else {
145154
response.pipe(fileStream);

lib/download.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ options.headers = Object.assign({}, options.headers, {
3131
https.get(options, function (response) {
3232
const contentEncoding = response.headers['content-encoding'];
3333
if (typeof contentEncoding === 'string' && contentEncoding.match(/gzip/i)) {
34+
if (process.env.BROWSERSTACK_LOCAL_DEBUG_GZIP) {
35+
console.info('using gzip in ' + options.headers['user-agent']);
36+
}
37+
3438
response.pipe(zlib.createGunzip()).pipe(fileStream);
3539
} else {
3640
response.pipe(fileStream);

0 commit comments

Comments
 (0)