HttpHeaders interface

Represents a set of HTTP headers on a request/response. Header names are treated as case insensitive.

Extends

Iterable<[string, string]>

Methods

delete(string)

Removes a specific header from the collection.

get(string)

Returns the value of a specific header or undefined if not set.

has(string)

Returns true if the specified header exists.

set(string, string | number | boolean)

Sets a specific header with a given value.

toJSON({ preserveCase?: boolean })

Accesses a raw JS object that acts as a simple map of header names to values.

Inherited Methods

[iterator]()

Method Details

delete(string)

Removes a specific header from the collection.

function delete(name: string)

Parameters

name

string

The name of the header to delete.

get(string)

Returns the value of a specific header or undefined if not set.

function get(name: string): undefined | string

Parameters

name

string

The name of the header to retrieve.

Returns

undefined | string

has(string)

Returns true if the specified header exists.

function has(name: string): boolean

Parameters

name

string

The name of the header to check.

Returns

boolean

set(string, string | number | boolean)

Sets a specific header with a given value.

function set(name: string, value: string | number | boolean)

Parameters

name

string

The name of the header to set.

value

string | number | boolean

The value to use for the header.

toJSON({ preserveCase?: boolean })

Accesses a raw JS object that acts as a simple map of header names to values.

function toJSON(options?: { preserveCase?: boolean }): RawHttpHeaders

Parameters

options

{ preserveCase?: boolean }

Returns

Inherited Method Details

[iterator]()

function [iterator](): Iterator<[string, string], any, undefined>

Returns

Iterator<[string, string], any, undefined>

Inherited From Iterable.__@iterator@202