File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ const REQ_TIMEOUT = 40000;
18
18
const VERBOSE = true ;
19
19
// Randomize test ordering (otherwise glob sorting is used):
20
20
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'
21
25
22
26
/**
23
27
* Load Tester for imageservers
@@ -170,7 +174,21 @@ function runReq(req, completion) {
170
174
}
171
175
}
172
176
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 )
174
192
. on ( 'error' , onError )
175
193
. on ( 'response' , onResponse ) ;
176
194
}
You can’t perform that action at this time.
0 commit comments