Request Generator

This web page will generate a stream of requests against one or more HTTP Endpoints, with parameters that you specify.

Basic Usage

  1. Define one or more batches; each batch specifies a series of 1 or more identical GET/POST/PUT requests that will be sent.
  2. For each batch, select the verb, the URL, and optionally the headers to send. If the verb is PUT or POST, then you can also specify the request payload.
  3. Also adjust the "batch size" if you like - this is the number of identical requests to make in sequence.
  4. If you want to send requests of different types, you can click the + tab to add a new batch of requests, with a new verb, url, headers, payload, and batchsize.
  5. If you added a batch you don't want, click the X to remove the tab.
  6. Select the "speed factor". It goes to 11. This apples to the set of all batches.
  7. Batches run in sequence. So if you have two batches, with batchsize 1 and 14 respectively, each run will send one of the first request, and 14 of the second. If the speedfactor is low enough and the response rate is fast enough, the logic will sleep between runs.
  8. Hint: use batch 1 to POST to your /token endpoint, then extract the token, and use batch 2 to invoke a number of requests with that token.

Templates

  1. You can specify the initial context in JSON format in the Initial Context tab. Make sure it's valid.
  2. You can use handlebars expressions to inject things from the context into the URL, payload, or headers. For example suppose your context is {"client_id" : "ABC", "client_secret": "DEF"} . You can use {{client_id}} in any URL, payload, or header (name or value) to emit the value "ABC".
  3. There are handlebars helper functions available:
    • httpbasicauth - suppose your context is {"client" : {"id":"ABC", "secret":"DEF"}} . You can use {{httpbasicauth client.id client.secret}} to produce an HTTP Basic Auth header value: the word "Basic " followed by a base64 blob.
    • random - {{random 2 20}} generates a random number between 2 and 20.
    • randomItem - {{randomItem a}} selects a random item from the array a.
    • randomString - {{randomString}} generates a string of length between 12 and 40, consisting of random ASCII alphanumeric characters.{{randomString 23}} generates a random string of length 23.
    • weightedRandomSelect - selects a random item from the array aa using a weighted selector. Each element of the array must itself be an array of form[VALUE, WEIGHT]. For example, {{weightedRandomSelect aa}} selects "Mackerel" 10 times for every one time it selects "Sardine" if the array is[ ["Mackerel", 10], ["Sardine", 1]]. The value returned is the first element of the selected inner 2-element array. One application of this is to use a variety of client_ids for calls. Another option is to use it to randomly select IP addresses to insert into an X-Forwarded-For header.
  4. For each type of request, you can extract values from the response JSON payloads using jsonpath. Use the "Post-Response Extracts" tab to specify that. You can then employ those values via handlebars templates in the url, payload, or headers for subsequent requests.

Other Notes

  1. Endpoints specified here must support CORS and must allow any origin. If you don't have a CORS-enable endpoint, then all requests will fail. This is due to the same-origin policy enforced by the browser.
  2. The behavior of the extraction logic is not defined or tested for responses that contain non-JSON payloads.
  3. You can change any of the settings - method, URL, headers, payload, extracts, batchsize, speed, - while the agent is running. But be careful; the agent won't wait for you to get everything formatted correctly in your URL or JSON payload.
  4. When you click "Start", this page uses LocalStorage to store your settings. Click the "JSON Configuration" tab to see or modify the configuration in JSON form. You may wish to ctrl-C copy this JSON and save it locally, or ctrl-V paste in a new configuration.
  5. No information is sent to any endpoint, other than the ones you specify explicitly as endpoints.
status: --
success: 0
errors: 0