Comparing version 6.3.1 to 6.3.2
{ | ||
"name": "loadtest", | ||
"version": "6.3.1", | ||
"version": "6.3.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "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.", |
@@ -303,26 +303,5 @@ [![run on repl.it](http://repl.it/badge/github/alexfernandez/loadtest)](https://repl.it/github/alexfernandez/loadtest) | ||
Use custom request generator function from an external file. | ||
Example request generator module could look like this: | ||
```javascript | ||
module.exports = function(params, options, client, callback) { | ||
generateMessageAsync(function(message) { | ||
if (message) | ||
{ | ||
options.headers['Content-Length'] = message.length; | ||
options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; | ||
} | ||
request = client(options, callback); | ||
if (message){ | ||
request.write(message); | ||
} | ||
return request; | ||
} | ||
} | ||
``` | ||
See [`sample/request-generator.js`](sample/request-generator.js) for some sample code including a body | ||
Use a custom request generator function from an external file. | ||
See an example of a request generator module in [`--requestGenerator`](#requestGenerator) below. | ||
Also see [`sample/request-generator.js`](sample/request-generator.js) for some sample code including a body | ||
(or [`sample/request-generator.ts`](sample/request-generator.ts) for ES6/TypeScript). | ||
@@ -669,3 +648,4 @@ | ||
Custom request generator function. | ||
Use a custom request generator function. | ||
The request needs to be generated synchronously and returned when this function is invoked. | ||
@@ -676,14 +656,9 @@ Example request generator function could look like this: | ||
function(params, options, client, callback) { | ||
generateMessageAsync(function(message)) { | ||
request = client(options, callback); | ||
if (message) | ||
{ | ||
options.headers['Content-Length'] = message.length; | ||
options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; | ||
request.write(message); | ||
} | ||
request.end(); | ||
} | ||
const message = generateMessage(); | ||
const request = client(options, callback); | ||
options.headers['Content-Length'] = message.length; | ||
options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; | ||
request.write(message); | ||
request.end(); | ||
return request; | ||
} | ||
@@ -690,0 +665,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102734
951