Skip to content

HTTP Actions

The HTTP Action lets you send an HTTP/HTTPS request to a web server. There are height types of HTTP request actions. One for each HTTP method.

HTTP Request Action

The first line displays the request method and the full request URL. The second line of the HTTP Request Action lets you select the server and fill in the path. The third line of the HTTP Request Action gives access to multiple configuration tabs:

It also allows the configuration of the Download resources and Follow redirects options.

Request URL

This section explains how to configure the URL of an HTTP request action.

In the above screenshot the URL displayed on the first line of the Action is http://petstore.octoperf.com:80/actions/Catalog.action?viewProduct&productId=K9-DL-01.

This URL is divided in 3 parts:

  1. The server http://petstore.octoperf.com:80.
  2. The path /actions/Catalog.action.
  3. The parameters ?viewProduct&productId=K9-DL-01 are configured in the URL Parameters tab.

Server

HTTP Request server

The request server can be selected using the server combo box. You can type a name in this input to filter the servers list. All servers are configured in the servers view.

Note

If your project has no server yet, the server selector is replaced by a Add Server button. This button opens the servers view.

Path

The path input lets you type the request line which is the resource called from the server (here /actions/Catalog.action).

URL Parameters

The URL Parameters tab show a table that contains one row for each query parameter. E.g. with the parameters ?viewProduct&productId=K9-DL-01:

URL Parameters

You can click on the Key input of the last line to add a query parameter. On the right of the table, click on any delete button to remove a line.

The columns are defined as follows:

Column name Description Required
Key The name of the query parameter Yes
Include '=' ? For query parameters without value, select this option to include an '=' after the name. E.g. if this option was selected in the above screenshot for viewProduct, the generated query string would be ?viewProduct=&productId=FI-FW-01 Only if you need a query parameter value
Value The value of the query parameter No
Encode? Should this query parameter be URL encoded. URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits. No

Request Headers

The HTTP Headers tab show a table that contains one row for each request header. HTTP headers lets you define, among many other things:

  • The expected content type,
  • The content length,
  • The authorization,
  • The accepted charset, encoding and language,
  • ...

HTTP Headers

You can click on the Key input of the last line to add a query parameter. On the right of the table, click on any delete button to remove a line.

The columns are defined as follows:

Column name Description Required
Key The name of the HTTP header Yes
Value The value of the HTTP Header Yes

Info

The Cookie header is automatically handled by the platform. You do not need to extract or inject it. The User-Agent is overwritten when the Virtual User is running. The configuration of the User Agent is done in the scenario.

Request Body

The request body, or POST data, can be configured in three different ways :

  • form-data: The content type multipart/form-data should be used for submitting forms that contain files, non-ASCII data, and binary data. With multipart/form-data no characters are encoded. This value is required when you are using forms that have a file upload control.
  • x-www-form-urlencoded: The content type application/x-www-form-urlencoded is inefficient for sending large quantities of binary data or text containing non-ASCII characters. Using application/x-www-form-urlencoded all characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values).
  • or just plain raw text requests: For text/plain spaces are converted to "+" symbols, but no special characters are encoded.
  • file: Particular application/x-www-form-urlencoded content type that uploads only one single file.

Tip

Duplicate the request before playing with the request body settings. When you switch between body types the body is emptied.

form-data

Form data

The multipart/form-data content-type is used by web browsers if the form contains the enctype="multipart/form-data" attribute.

<form action="demo_post_enctype.asp" method="post" enctype="multipart/form-data">

The form-data table lets you add multiple files or key/value pairs to your request body.

Column name Description Required
Key The identifier of the body part Yes
Type The type of part : Text or File Yes
Value An input text for text entries and a file uploader for file entries Yes

In some situations, it might be required to only send the Content-Disposition header, that is possible through the Browser-compatible headers option, here's a comparison using the above example:

Regular headers

Browser compatible headers

x-www-form-urlencoded

Form urlencoded

When a web browser sends a POST request from a web form element, the default media type is application/x-www-form-urlencoded.

The x-www-form-urlencoded table lets you add multiple key/value pairs to your request body.

Column name Description Required
Key The name of the parameter Yes
Include '=' ? For parameters without value, select this option to include an '=' after the name Only if you need a query parameter value
Value The value of the parameter No
Encode? Should this parameter be URL encoded No

Note

For urlencoded requests, OctoPerf automatically adds the appropriate Content-Type header and converts the parameters.

x-www-form-urlencoded is a format for encoding key-value pairs with possibly duplicate keys. Each key-value pair is separated by an '&' character, and each key is separated from its value by an '=' character. Keys and values are both escaped by replacing spaces with the '+' character and then using URL encoding on all other non-alphanumeric characters.

For example, the key-value pairs

  • Name: Jonathan Doe
  • Age: 23
  • Formula: a + b == 13%!

are encoded as Name=Jonathan+Doe&Age=23&Formula=a+%2B+b+%3D%3D+13%25%21

raw

Raw

The raw POST data tab only contains a text input. You can simply type the content of the request body.

Info

You can change the format of the raw POST data by using the buttons at the bottom right corner of the editor. The request 'Content-Type' header is automatically modified according to this format!

file

File

The file tab lets you add one single file to your request body.

With this option the content of the file is copied directly into a the POST body. It is possible to achieve the same through a raw body if you copy/paste your file in it but that will inflate the size of your virtual user and can impact its performance.

Name Description Required
File A file uploader for file entries Yes
Content Type A text input for the file content type (usually application/binary) Yes

Warning

Some HAR recorders will not save the file into the request body. Because of this we cannot detect that it is a file upload and you will have to manually activate this option.

Think Time

The think time allows you to pause your Virtual Users after the processing of an HTTP Request Action. It can be configured to pause for a constant delay, a range or a variable delay.

Its value is automatically set if you import a HAR file to create a Virtual User. We use the requests timestamps to compute the time between them for you.

As they serve to represent user interaction delay, Think times are not taken into account when computing server response times.

Warning

If a think time is higher than the remaining duration for the test, the virtual user will be stopped automatically. This mechanism is used to free memory but it will be visible on the # of Users statistics of the report. To avoid this it is recommended to use small values in regards to the test duration (for example: >1 min for 1 hour test)

Constant Delay

Constant Delay

Parameter name Description Required
Duration Duration of the delay, from 0 to 99999. Yes
Unit Time unit: minutes, seconds or milliseconds. Yes

Range Delay

Range Delay

Parameter name Description Required
From Lower bound of the range delay, from 0 to 99999. Yes
To Uper bound of the range delay, from 0 to 99999. Yes
Unit Time unit: minutes, seconds or milliseconds. Yes

Text Delay

Text Delay

Parameter name Description Required
Text Delay value in milliseconds or variable name ${myCustomDelay} or any expression that evaluates to a delay in milliseconds. Yes

Check Request / Response

These two tabs allow you to view the requests and responses played during the record of the Virtual User and during a Validate VU.

When the same request / response is selected in both lists you get a detailed view with formatting options:

Check Responses with formatters

When a different request / response is selected, it lets you compare the data (URL, headers and body) of recorded and check requests / responses:

Check Responses

To change the compared requests / responses, simply click on the select boxes and select the item wanted. A warning icon may appear on the items that caused an error during the last Validate VU.

Icon Action Description
Save as recorded This action will overwrite the recorded response with the new one. Be careful, it cannot be undone.
Open in a new tab Sends the response content in a new browser tab to attempt rendering it.

Tip

If you create a Virtual User by hand (without importing a HAR), recorded requests and responses are not present. You may run a Validate VU to get requests / responses.

Note

You can search for Strings or Regular Expressions (JavaScript format) inside headers and bodies:

  1. Click on a code text area,
  2. Type CTRL + F (or CMD + F on Mac), a dialog appears on top of the area,
  3. Type the text to search or a regex,
  4. Press Enter to start searching for the first term occurrence
  5. Press CTRL + G (or CMD + G on Mac) to find the next occurrence, or SHIFT + CTRL + G (or SHIFT + CMD + G on Mac) to find the previous one.

Advanced Configuration

Http Action Advanced Configuration

Content Encoding

Content encoding to be used (for POST, PUT, PATCH and FILE). This is the character encoding to be used, and is not related to the Content-Encoding HTTP header.

Default value (if left empty) is UTF-8.

Download Resources

If this option is selected, OctoPerf parses the HTML file received and sends HTTP/HTTPS requests for all images, Java applets, JavaScript files, CSSs, etc. referenced in the file.

Note

If the request has a HOST header it will be used when fetching the resources as well. When the resources have a different domain, this can generate 404 responses. To prevent this, remove the HOST header from the main request.

Warning

This option consumes a lot of computing power, to compensate for that we will consider the virtual users as Heavy VUs.

Follow Redirects

If this option is selected, OctoPerf checks if the response is a redirect (status code 3xx) and follows it.

Parallel Downloads Number

Modern browsers use ~6 parallel threads for downloading embedded resources. Adjust the value up or down to mimic browser(s) you would like to simulate.

URLs Must Match

If present, this must be a regular expression that is used to match against any embedded URLs found. So if you only want to download embedded resources from:

  • a single domain, use: http://example\.com/.*,
  • Or a list of specific domains, use: ^((?!<domain #1>|<domain #2>|<domain #3><domain #4>|<domain #5>).)*$