HttpHeadersLike interface
The legacy HTTP header collection exposed by the _response field.
Methods
| clone() | Create a deep copy of this collection. |
| contains(string) | Check whether a header exists. |
| get(string) | Get a header using a case-insensitive name. |
| header |
Get the header names. |
| headers |
Get the headers as an array. |
| header |
Get the header values. |
| raw |
Get the headers as an object. |
| remove(string) | Remove a header, returning whether it existed. |
| set(string, string | number) | Set a header using a case-insensitive name. |
| to |
Get the JSON representation of this collection. |
Method Details
clone()
contains(string)
Check whether a header exists.
function contains(headerName: string): boolean
Parameters
- headerName
-
string
The name of the header.
Returns
boolean
get(string)
Get a header using a case-insensitive name.
function get(headerName: string): string | undefined
Parameters
- headerName
-
string
The name of the header.
Returns
string | undefined
headerNames()
Get the header names.
function headerNames(): string[]
Returns
string[]
headersArray()
headerValues()
Get the header values.
function headerValues(): string[]
Returns
string[]
rawHeaders()
remove(string)
Remove a header, returning whether it existed.
function remove(headerName: string): boolean
Parameters
- headerName
-
string
The name of the header.
Returns
boolean
set(string, string | number)
Set a header using a case-insensitive name.
function set(headerName: string, headerValue: string | number)
Parameters
- headerName
-
string
The name of the header to set.
- headerValue
-
string | number
The value of the header to set.
toJson({ preserveCase?: boolean })
Get the JSON representation of this collection.
function toJson(options?: { preserveCase?: boolean }): RawHttpHeaders
Parameters
- options
-
{ preserveCase?: boolean }
Whether to preserve the original casing of header names.