web.addAutoHeader

Adds the specified header to all subsequent HTTP requests.

Syntax

web.addAutoHeader( header, content ); 
Argument
Description
header
The name of the header
Examples: "Accept", "Accept–Encoding"
content
The value (data) associated with the user–defined header

Return Values

Not applicable

Parameterization

The following argument(s) can be parameterized using standard parameterization: header, content.

General Information

The web.addAutoHeader function is a service function that adds a header to all subsequent HTTP requests.

Web scripts automatically send standard headers with each HTTP request they submit. You can add additional headers using the web.addAutoHeader function. This instructs VuGen to generate the specified header for all HTTP requests that follow. This is in contrast to the web.addHeader function that applies only to the HTTP request that follows it.

The web.addAutoHeader function is generated automatically when headers are required for two consecutive steps, provided that header generation is enabled in the Advanced tab of the Recording Options. Refer to Setting Advanced Recording Options in the Virtual User Generator Help Center (select the relevant version).

You can also add this function to your script manually.

To enable compression and decompression for browsers, set the Accept–Encoding option to gzip:

web.addAutoHeader("Accept–Encoding", "gzip");

You can verify if the server sent compressed data, by searching for the string "Content–Encoding: gzip" in the Execution log.

To cancel automatic header generation, use:

Note:  

  • This function is supported in HTTP or Wireless Session Protocol (WSP) replay mode. This function cannot be used in concurrent groups.
  • This function ignores web_rest (or web.rest) steps which send REST API requests.

Example

web.addAutoHeader("Accept-Encoding", "gzip")