headers.d.ts
2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Polyfill for [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers), as
* specified in the [Fetch Spec](https://fetch.spec.whatwg.org/#headers-class).
*
* The only known difference between this `Headers` implementation and the spec is the
* lack of an `entries` method.
*
* ### Example
*
* ```
* import {Headers} from '@angular/http';
*
* var firstHeaders = new Headers();
* firstHeaders.append('Content-Type', 'image/jpeg');
* console.log(firstHeaders.get('Content-Type')) //'image/jpeg'
*
* // Create headers from Plain Old JavaScript Object
* var secondHeaders = new Headers({
* 'X-My-Custom-Header': 'Angular'
* });
* console.log(secondHeaders.get('X-My-Custom-Header')); //'Angular'
*
* var thirdHeaders = new Headers(secondHeaders);
* console.log(thirdHeaders.get('X-My-Custom-Header')); //'Angular'
* ```
*
* @experimental
*/
export declare class Headers {
constructor(headers?: Headers | {
[name: string]: any;
});
/**
* Returns a new Headers instance from the given DOMString of Response Headers
*/
static fromResponseHeaderString(headersString: string): Headers;
/**
* Appends a header to existing list of header values for a given header name.
*/
append(name: string, value: string): void;
/**
* Deletes all header values for the given name.
*/
delete(name: string): void;
forEach(fn: (values: string[], name: string, headers: Map<string, string[]>) => void): void;
/**
* Returns first header that matches given name.
*/
get(name: string): string;
/**
* Checks for existence of header by given name.
*/
has(name: string): boolean;
/**
* Returns the names of the headers
*/
keys(): string[];
/**
* Sets or overrides header value for given name.
*/
set(name: string, value: string | string[]): void;
/**
* Returns values of all headers.
*/
values(): string[][];
/**
* Returns string of all headers.
*/
toJSON(): {
[name: string]: any;
};
/**
* Returns list of header values for a given name.
*/
getAll(name: string): string[];
/**
* This method is not implemented.
*/
entries(): void;
private mayBeSetNormalizedName(name);
}