Skip to content

Commit 49ad2c3

Browse files
updated as per review suggestion
1 parent 4f6448c commit 49ad2c3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

wtp/apiCaller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const runWtpTest = async (url, mobile, cb) => {
7474
fvonly: 1, // first view only
7575
timeline: 1 // workaround for WPT sometimes hanging on getComputedStyle()
7676
},
77-
headers: { 'User-Agent': 'WebSpeedTest', 'X-WPT-API-KEY': apiKeys.get() },
77+
headers: { 'User-Agent': 'WebSpeedTest', 'X-WPT-API-KEY': apiKeys.getRandom() },
7878
throwHttpErrors: false
7979
};
8080
let response;

wtp/apiKey.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
const config = require('config');
44

5-
function get() {
5+
function getRandom() {
66
const apiKeys = config.get('wtp.apiKey').split(',');
77
const apiKey = apiKeys[Math.floor(Math.random() * apiKeys.length)];
88
return apiKey;
99
}
1010

1111
module.exports = {
12-
get
12+
getRandom: getRandom
1313
};

wtp/locationSelector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class LocationSelector {
2828
let options = {
2929
method: "GET",
3030
url: GET_LOCATIONS,
31-
headers: {'User-Agent': 'WebSpeedTest', 'X-WPT-API-KEY': apiKeys.get()},
31+
headers: {'User-Agent': 'WebSpeedTest', 'X-WPT-API-KEY': apiKeys.getRandom()},
3232
};
3333
let response;
3434
let rollBarMsg = {};

0 commit comments

Comments
 (0)