JavaScript object: Header

The following JavaScript object is unique to ITSMA Service Management.

With no arguments, the Header() constructor creates an empty Header object.

With the HTTP header arguments, the Header() constructor creates a Header object containing the provided header types and values. You must enclose header types and header values in quotation marks.

Constructor

new Header();
new Header(Header type, Header value);

Arguments

The following arguments are valid for this object:

Argument Description
Header type The HTTP header type such as Accept-Encoding or Content-Type.
Header value The HTTP header value such as gzip,deflate or text/html.

Properties

None

Methods

None

Example

This example does the following:

  • Creates a Header object using the Header type and Header value arguments
  • Creates a second empty Header object
  • Defines the properties of the second Header object
  • Creates an empty JavaScript array
  • Adds the two Header objects to the JavaScript array

This example requires the following sample data:

  • A valid header
var h = new Header( "Accept-Encoding", "gzip,deflate" );
var hd = new Header();
hd.name = "Content-Type";
hd.value = "text/html";
var headers = new Array();
headers.push( h );
headers.push( hd );