Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1b58e5

Browse files
committed
Support requests via the streambed API
1 parent 251ab4b commit f1b58e5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/image/load_test

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const REQ_TIMEOUT = 40000;
1818
const VERBOSE = true;
1919
// Randomize test ordering (otherwise glob sorting is used):
2020
const RANDOMIZE = false;
21+
// Specify a username and API key to make requests via the streambed v2 API,
22+
// otherwise set falsy to make a direct request.
23+
const PLOTLY_USERNAME='._-aA1'
24+
const PLOTLY_API_KEY='testapikey'
2125

2226
/**
2327
* Load Tester for imageservers
@@ -170,7 +174,21 @@ function runReq(req, completion) {
170174
}
171175
}
172176

173-
request.post({uri: endpointUrl, body: body, timeout: REQ_TIMEOUT})
177+
var postArgs = {uri: endpointUrl, body: body, timeout: REQ_TIMEOUT}
178+
179+
if (PLOTLY_USERNAME) {
180+
postArgs.auth = {
181+
user: PLOTLY_USERNAME,
182+
pass: PLOTLY_API_KEY,
183+
sendImmediately: true
184+
}
185+
postArgs.headers = {
186+
'Content-Type': 'application/json',
187+
'Plotly-Client-Platform': 'Load Test'
188+
}
189+
}
190+
191+
request.post(postArgs)
174192
.on('error', onError)
175193
.on('response', onResponse);
176194
}

0 commit comments

Comments
 (0)