LoadVars.addRequestHeader()

Availability

Flash Player 6.

Usage

my_lv.addRequestHeader(headerName, headerValue)
my_lv.addRequestHeader(["headerName_1", "headerValue_1" ... "headerName_n", "headerValue_n"])

Parameters

headerName An HTTP request header name.

headerValue The value associated with headerName.

Returns

Nothing.

Description

Method; adds or changes HTTP request headers (such as Content-Type or SOAPAction) sent with POST actions. In the first usage, you pass two strings to the method: headerName and headerValue. In the second usage, you pass an array of strings, alternating header names and header values.

If multiple calls are made to set the same header name, each successive value will replace the value set in the previous call.

The following standard HTTP headers cannot be added or changed with this method: Accept-Ranges, Age, Allow, Allowed, Connection, Content-Length, Content-Location, Content-Range, ETag, Host, Last-Modified, Locations, Max-Forwards, Proxy-Authenticate, Proxy-Authorization, Public, Range, Retry-After, Server, TE, Trailer, Transfer-Encoding, Upgrade, URI, Vary, Via, Warning, and WWW-Authenticate.

Example

This example adds a custom HTTP header named SOAPAction with a value of Foo to the my_lv object.

my_lv.addRequestHeader("SOAPAction", "'Foo'");

This next example creates an array named headers that contains two alternating HTTP headers and their associated values. The array is passed as an argument to addRequestHeader().

var headers = ["Content-Type", "text/plain", "X-ClientAppVersion", "2.0"];
my_lv.addRequestHeader(headers);

See also

XML.addRequestHeader()