Skip to content

Commit 8a76d46

Browse files
committed
Fix error when Sauce env vars aren't set
1 parent b4f1005 commit 8a76d46

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/sauce.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ export default class SauceClient {
4040

4141
get (path, query, customTTL) {
4242
const url = this.getURL(path, query)
43+
const auth = {
44+
user: process.env.SAUCE_USERNAME,
45+
pass: process.env.SAUCE_ACCESS_KEY
46+
}
4347
const options = {
4448
json: true,
4549
gzip: true,
46-
headers: {
47-
'X-RateLimit-Enable': 'false'
48-
},
49-
auth: {
50-
user: process.env.SAUCE_USERNAME,
51-
pass: process.env.SAUCE_ACCESS_KEY
52-
}
50+
headers: { 'X-RateLimit-Enable': 'false' },
51+
auth: auth.user && auth.pass ? auth : null
5352
}
5453
return cachedRequest(url, options, customTTL)
5554
}

0 commit comments

Comments
 (0)