HttpHeaders
Represents the header configuration options for an HTTP request. Instances are immutable. Modifying methods return a cloned instance with the change. The original object is never changed.
class HttpHeaders {
constructor(headers?: string | { [name: string]: string | number | (string | number)[]; } | Headers)
has(name: string): boolean
get(name: string): string | null
keys(): string[]
getAll(name: string): string[] | null
append(name: string, value: string | string[]): HttpHeaders
set(name: string, value: string | string[]): HttpHeaders
delete(name: string, value?: string | string[]): HttpHeaders
}
Constructor
Constructs a new HTTP header object with the given values. |
Methods
has() |
---|
Checks for existence of a given header. |
get() |
---|
Retrieves the first value of a given header. |
keys() |
---|
Retrieves the names of the headers. |
ParametersThere are no parameters. Returns
|
getAll() |
---|
Retrieves a list of values for a given header. |
append() | ||||||
---|---|---|---|---|---|---|
Appends a new value to the existing set of values for a header and returns them in a clone of the original instance. |
||||||
Parameters
Returns
|
set() | ||||||
---|---|---|---|---|---|---|
Sets or modifies a value for a given header in a clone of the original instance. If the header already exists, its value is replaced with the given value in the returned object. |
||||||
Parameters
Returns
|
delete() | ||||||
---|---|---|---|---|---|---|
Deletes values for a given header in a clone of the original instance. |
||||||
Parameters
Returns
|