loadtest 6.3.1 → 6.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -300,30 +300,9 @@ Setting this to 0 disables timeout (default).
|
|
|
300
300
|
|
|
301
301
|
#### `-R requestGeneratorModule.js`
|
|
302
302
|
|
|
303
|
-
Use custom request generator function from an external file.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
```javascript
|
|
308
|
-
module.exports = function(params, options, client, callback) {
|
|
309
|
-
generateMessageAsync(function(message) {
|
|
310
|
-
|
|
311
|
-
if (message)
|
|
312
|
-
{
|
|
313
|
-
options.headers['Content-Length'] = message.length;
|
|
314
|
-
options.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
315
|
-
}
|
|
316
|
-
request = client(options, callback);
|
|
317
|
-
if (message){
|
|
318
|
-
request.write(message);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
return request;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
See [`sample/request-generator.js`](sample/request-generator.js) for some sample code including a body
|
|
303
|
+
Use a custom request generator function from an external file.
|
|
304
|
+
See an example of a request generator module in [`--requestGenerator`](#requestGenerator) below.
|
|
305
|
+
Also see [`sample/request-generator.js`](sample/request-generator.js) for some sample code including a body
|
|
327
306
|
(or [`sample/request-generator.ts`](sample/request-generator.ts) for ES6/TypeScript).
|
|
328
307
|
|
|
329
308
|
#### `--agent` (deprecated)
|
|
@@ -665,24 +644,20 @@ How many requests each client will send per second.
|
|
|
665
644
|
|
|
666
645
|
#### `requestGenerator`
|
|
667
646
|
|
|
668
|
-
|
|
647
|
+
Use a custom request generator function.
|
|
648
|
+
The request needs to be generated synchronously and returned when this function is invoked.
|
|
669
649
|
|
|
670
650
|
Example request generator function could look like this:
|
|
671
651
|
|
|
672
652
|
```javascript
|
|
673
653
|
function(params, options, client, callback) {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
request.write(message);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
request.end();
|
|
685
|
-
}
|
|
654
|
+
const message = generateMessage();
|
|
655
|
+
const request = client(options, callback);
|
|
656
|
+
options.headers['Content-Length'] = message.length;
|
|
657
|
+
options.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
658
|
+
request.write(message);
|
|
659
|
+
request.end();
|
|
660
|
+
return request;
|
|
686
661
|
}
|
|
687
662
|
```
|
|
688
663
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loadtest",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Run load tests for your web application. Mostly ab-compatible interface, with an option to force requests per second. Includes an API for automated load testing.",
|
|
6
6
|
"homepage": "https://github.com/alexfernandez/loadtest",
|