new Headers(channel, direction)
Headers is an object to access and modify headers of a request. It
implements an interface similar to the JS Map object. It also implements
the iterable protocol, so you can iterate over it with for...of loops.
Each value when iterating is a module:lib/headers~HeaderTuple.
Extends:
Parameters:
Name | Type | Description |
---|---|---|
channel |
external:nsIHttpChannel | |
direction |
module:requestmod.INCOMING | module:requestmod:OUTGOING |
- Source:
Extends
Methods
delete(header)
Removes a header from the request.
Parameters:
Name | Type | Description |
---|---|---|
header |
string | (case sensitive) header name |
- Source:
forEach(callback, thisArg)
Iterates over every set header.
Parameters:
Name | Type | Description |
---|---|---|
callback |
module:headers~forEachCallback | |
thisArg |
Object |
- Source:
get(header) → {string|undefined}
Gets the value of the specified header.
Parameters:
Name | Type | Description |
---|---|---|
header |
string | (case sensitive) header name |
- Source:
Returns:
returns `undefined` if the header is not set.
- Type
- string | undefined
has(header) → {boolean}
Check if a header is set.
Parameters:
Name | Type | Description |
---|---|---|
header |
string | (case sensitive) header name |
- Source:
Returns:
- Type
- boolean
set(header, value)
Sets the value of the specified header. Replaces the existing value or
creates a new header if a header with the given name doesn't exist yet.
Parameters:
Name | Type | Description |
---|---|---|
header |
string | (case sensitive) header name |
value |
string | Value to set the header to |
- Source: