Open topic with navigation
Adds the specified header to the next HTTP request.
web.addHeader( header, content );
The name of the user–defined header.
Examples: "Accept", "Accept–Encoding"
The value (data) associated with the user–defined header.
The following argument(s) can be parameterized using standard parameterization: header, content
The web.addHeader function is a service function that adds a user–defined header to the next HTTP request.
Web scripts automatically send standard headers with each HTTP request they submit. You can define additional user–defined headers from the Advanced tab in the Recording Options dialog box in VuGen. When you enable headers from the Recording Options, VuGen generates a web.addHeader function with the specified headers. It is recorded only when the recording headers option is enabled (see VuGen's Recording Advanced Options).
When two consecutive steps require headers, the web.addAutoHeader function is generated automatically. You can also manually add the web.addAutoHeader function to your script. The advantage of using web.addAutoHeader is that it applies to all HTTP requests that follow, unlike web.addHeader, which only applies to the HTTP request that follows it.
One common use of user–defined headers is to add user agent information. User agent information is often used for statistical purposes, for tracing of protocol violations, and for automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations, such as inability to support HTML tables.
This function can be used in concurrent groups.
Note: This function ignores web_rest (or web.rest) steps which send REST API requests.
web.addHeader("User-Agent", "ABC Browser 1.0");