HttpHeaders
class
HttpHeaders class represents the header configuration options for an HTTP request. Instances should be assumed immutable with lazy parsing.
class HttpHeaders {
constructor(headers?: string | { [name: string]: string | string[]; })
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. | |||
constructor(headers?: string | { [name: string]: string | string[]; })Parameters
|
Methods
|
has() | |||
|---|---|---|---|
| Checks for existence of a header by a given name. | |||
has(name: string): booleanParameters
Returns
|
|
get() | |||
|---|---|---|---|
| Returns the first header value that matches a given name. | |||
get(name: string): string | nullParameters
Returns
|
|
keys() |
|---|
| Returns the names of the headers. |
keys(): string[]ParametersThere are no parameters. Returns
|
|
getAll() | |||
|---|---|---|---|
| Returns a list of header values for a given header name. | |||
getAll(name: string): string[] | nullParameters
Returns
|
|
append() | ||||||
|---|---|---|---|---|---|---|
| Appends a new header value to the existing set of header values. | ||||||
append(name: string, value: string | string[]): HttpHeadersParameters
Returns
|
|
set() | ||||||
|---|---|---|---|---|---|---|
| Sets a header value for a given name. If the header name already exists, its value is replaced with the given value. | ||||||
set(name: string, value: string | string[]): HttpHeadersParameters
Returns
|
|
delete() | ||||||
|---|---|---|---|---|---|---|
| Deletes all header values for a given name. | ||||||
delete(name: string, value?: string | string[]): HttpHeadersParameters
Returns
|
© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v7.angular.io/api/common/http/HttpHeaders