GetHeader Function

Description:

The GetHeader function sets either all the HTTP headers or a single HTTP header (specified in the HttpHeaderName optional parameter) in a string variable. This function can be either integrated into HTTP/S requests or executed independently.

If the function is not attached to a HTTP request, the first parameter is the input character string on which the function is applied.

Format:

HTTP GET HOST Hostname URL url szVar = GetHeader(options);
HTTP GET HOST Hostname URL url szVar = GetHeader(options, HeaderName);
HTTP GET HOST Hostname URL url szVar = GetHeader(options, HeaderName, Index);
szVar = GetHeader(HttpHeaders, HeaderName);
szVar = GetHeader(HttpHeaders, HeaderName, Index);

Parameters:

szVar

A string variable into which the headers will be loaded.

options

Available options are:

CONTENT  The function is applied on the current HTTP response 

HeaderName

A string expression containing the name of the HTTP header to be retrieved.

HttpHeaders

A string expression containing a set of HTTP headers from which the function will extract a specified header.

Index

An integer expression which specifies the index of the HeaderName HTTP header name to be retrieved.

Example:

STRING szContentTypeHeader;
STRING szServerHeader;
STRING szAllHeader;

HTTP GET HOST "demo.fmstocks.com" URL "/fmstocks/home.asp" szContentTypeHeader = GetHeader(content, "Content-Type");
HTTP GET HOST "demo.fmstocks.com" URL "/fmstocks/home.asp" szAllHeader = GetHeader(content);
szServerHeader = GetHeader(szAllHeader, "Server");

// Retrieve second Set-Cookie HTTP header
HTTP GET HOST "demo.fmstocks.com" URL "/fmstocks/home.asp" szSetCookieHeader = GetHeader(content, "Set-Cookie", 2);

See also:





Go back to the Learning center:


Copyright © AgileLoad. All rights reserved.
Agile Load testing tool| Contact AgileLoad | Terms of Use | Sitemap