Headers

This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples). In all methods of this interface, header names are matched by case-insensitive byte sequence.

interface Headers {
append(name: string, value: string): void;
delete(name: string): void;
forEach(callbackfn: (
value: string,
key: string,
parent: Headers,
) => void
, thisArg?: any): void;
get(name: string): string | null;
has(name: string): boolean;
set(name: string, value: string): void;
}
class Headers implements DomIterable<string, string> {
constructor(init?: HeadersInit);
append(name: string, value: string): void;
delete(name: string): void;
entries(): IterableIterator<[string, string]>;
forEach(callbackfn: (
value: string,
key: string,
parent: this,
) => void
, thisArg?: any): void;
get(name: string): string | null;
has(name: string): boolean;
keys(): IterableIterator<string>;
set(name: string, value: string): void;
values(): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<[string, string]>;
}

§Methods

§
append(name: string, value: string): void
[src]
§
delete(name: string): void
[src]
§
forEach(callbackfn: (
value: string,
key: string,
parent: Headers,
) => void
, thisArg?: any): void
[src]
§
get(name: string): string | null
[src]
§
has(name: string): boolean
[src]
§
set(name: string, value: string): void
[src]

§Implements

§
DomIterable<string, string>
[src]

§Constructors

§
new Headers(init?: HeadersInit)
[src]

§Methods

§
append(name: string, value: string): void
[src]

Appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist.

§
delete(name: string): void
[src]

Deletes a header from a Headers object.

§
entries(): IterableIterator<[string, string]>
[src]

Returns an iterator allowing to go through all key/value pairs contained in this Headers object. The both the key and value of each pairs are ByteString objects.

§
forEach(callbackfn: (value: string, key: string, parent: this) => void, thisArg?: any): void
[src]
§
get(name: string): string | null
[src]

Returns a ByteString sequence of all the values of a header within a Headers object with a given name.

§
has(name: string): boolean
[src]

Returns a boolean stating whether a Headers object contains a certain header.

§
keys(): IterableIterator<string>
[src]

Returns an iterator allowing to go through all keys contained in this Headers object. The keys are ByteString objects.

§
set(name: string, value: string): void
[src]

Sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist.

§
values(): IterableIterator<string>
[src]

Returns an iterator allowing to go through all values contained in this Headers object. The values are ByteString objects.

§
[Symbol.iterator](): IterableIterator<[string, string]>
[src]

The Symbol.iterator well-known symbol specifies the default iterator for this Headers object