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 HTTP Action is composed of many sections in order to configure:

Request URL

The request URL usually looks like this: 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. All servers are configured in the servers view but it is possible to create a new one with the Add Server button.


Path

The path lets you type the address of the resource to call on the server (here /actions/Catalog.action).

Info

The initial / will be automatically added if you omit it.

Query Parameters

The Query Parameters section shows a table that contains one row for each query parameter. For instance with the parameters ?viewCategory&categoryId=DOGS:

URL Parameters

Column name Description
Name The name of the query parameter.
= Select this option to include an '=' after the parameter name. Mandatory when the parameter has a value.
Value The value of the query parameter.
Encode Should this query parameter name and value be encoded. URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits.
add-line Click this icon to add a new parameter at the end of the list.
remove-line Click this icon to remove a parameter. Be careful, this action cannot be undone.

Info

The search functions are detailed in this section of the navigation page.

Request Headers

HTTP Headers

The HTTP Headers section is a table with 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,
  • ...

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 user profile settings.

Column name Description
Name The name of the header.
Value The value of the header.
add-line Click this icon to add a new header at the end of the list.
remove-line Click this icon to remove a header. Be careful, this action cannot be undone.
header-picker Select a header name from the most used headers list.

Info

The search functions are detailed in this section of the navigation page.

Request Body

The request body, or POST data, exists in 5 types:

  • Multipart: The content type multipart/form-data should be used for submitting forms that contain files, non-ASCII data, or 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.
  • 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 being sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values).
  • Raw text requests: For text/plain spaces are converted to "+" symbols, but no special characters are encoded.
  • File: Particular use case of application/x-www-form-urlencoded that focuses on uploading a single file,
  • None: When this request doesn't have a body at all (GET requests for example).

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.

Column name Description
Type Text or File
Name The name of the POST parameter.
Value The value of the POST parameter.
Content Type Mime type of the embedded file.
add-line Click this icon to add a new parameter at the end of the list.
remove-line Click this icon to remove a parameter. Be careful, this action cannot be undone.

Info

The search functions are detailed in this section of the navigation page.

In some situations, it is 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

Urlencoded

Form urlencoded

Column name Description
Name The name of the POST parameter.
= Select this option to include an '=' after the parameter name.Mandatory when the parameter has a value.
Value The value of the POST parameter.
Encode Should this POST parameter name and value be encoded. URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits.
add-line Click this icon to add a new parameter at the end of the list.
remove-line Click this icon to remove a parameter. Be careful, this action cannot be undone.

Info

The search functions are detailed in this section of the navigation page.

When a web browser sends a POST request from a web form element, the default media type is application/x-www-form-urlencoded. For these requests, OctoPerf automatically adds the appropriate Content-Type header and converts the parameters. application/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 only contains a text input.

You can simply type or paste the content of your request payload.

Variables are allowed inside the payload as for any other POST parameter.


http-post-raw-format

You can change the format of the raw POST data by using the http-post-raw-format-button button. The request Content-Type header is automatically modified according to this format. And you can use the Format content option to make the raw content easier to read.

Info

Setting the right formatting is not mandatory. If you don't plan on using it, just make sure that your payload is valid and manually add the proper headers.


file

File

The file option 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.

Column name Description
Name The name of the file as specified in the files menu.
Content Type Mime type of the embedded file.

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 upload the file and 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,range or text 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: less than 1 min for a 1 hour test)

Constant Delay

Type Description
Constant Constant waiting time, from 0 to 99999. Unit can be selected.
Range Random waiting time between two boundaries, from 0 to 99999. Unit can be selected.
Text Constant waiting time, can be a variable name. Always in milliseconds.

Configuration

Http Action Configuration

Option Description
Name Override the HTTP request default name (otherwise the default name is the request path).
Follow redirects If this option is selected, OctoPerf checks if the response is a redirect (status code 3xx) and follows it.
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 Enables the automatic download of resources, more details below.

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.

During runtime, only a single aggregated value for all Resources will be displayed. But when you run a validation they will all be displayed with the label Sub result in the Debug panel:

sub-samples

In the above screen shot, the difference between the label Validation and the first sub result Catalog.action is in the timings. If you only check the request/response contents, you'll notice they are identical, that's because:

  • Validation contains the time between the main request was sent and the last resource was downloaded (depending on parallel downloads),
  • Catalog.action contains the time for this particular HTTP request only.

timings-sub-samples

Warning

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

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. You can use it to:

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

Debug and validation

In order to validate your configuration we recommend to:

  • Replay your HTTP requests with the VU validation panel,
  • Then you can debug the content of your requests and responses in the Debug panel,
  • Once you've reached a satisfactory result, you can proceed to a real test.