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

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 applcation/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.

Tip

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

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

x-www-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

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

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.

Follow Redirects

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

Think Time

The think time allows you to pause your Virtual Users after the processing of an HTTP Request Action.

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

Info

The think time value is automatically set if you import a HAR/JMX file to create a Virtual User.

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.

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.