Adds the specified header to all subsequent HTTP requests.

C Language

int web_add_auto_header( const char *Header, const char *Content ); 

Java Language

int object.add_auto_header( String Header, String Content );
An expression evaluating to an object of type WebApi. Usually web for Java. See also Function and Constant Prefixes.
The name of the header
Examples: "Accept", "Accept–Encoding"
The value (data) associated with the user–defined header

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure. Note that in many cases, this return value indicates the technical success of the function, and not the result. For example, a function that registers a string to be found in a subsequent step returns LR_PASS to indicate that the registration was successful. This does not indicate that the string was found in the server response.


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

General Information

The web_add_auto_header 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_add_auto_header function. This instructs VuGen to generate the specified header for all HTTP requests that follow. This is in contrast to the web_add_header function that applies only to the HTTP request that follows it.

The web_add_auto_header 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_add_auto_header("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:


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