HttpHeaders
class
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 | 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 given header. | |||
has(name: string): booleanParameters
Returns
|
get() | |||
---|---|---|---|
Retrieves the first value of a given header. | |||
get(name: string): string | nullParameters
Returns
|
keys() |
---|
Retrieves the names of the headers. |
keys(): string[]ParametersThere are no parameters. Returns
|
getAll() | |||
---|---|---|---|
Retrieves a list of values for a given header. | |||
getAll(name: string): string[] | nullParameters
Returns
|
append() | ||||||
---|---|---|---|---|---|---|
Appends a new value to the existing set of values for a header and returns them in a clone of the original instance. | ||||||
append(name: string, value: string | string[]): HttpHeadersParameters
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. | ||||||
set(name: string, value: string | string[]): HttpHeadersParameters
Returns
|
delete() | ||||||
---|---|---|---|---|---|---|
Deletes values for a given header in a clone of the original instance. | ||||||
delete(name: string, value?: string | string[]): HttpHeadersParameters
Returns
|
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v8.angular.io/api/common/http/HttpHeaders