UNPKG

4.31 kBTypeScriptView Raw
1/**
2 * An individual header within a HttpHeaders collection.
3 */
4export interface HttpHeader {
5 /**
6 * The name of the header.
7 */
8 name: string;
9 /**
10 * The value of the header.
11 */
12 value: string;
13}
14/**
15 * A HttpHeaders collection represented as a simple JSON object.
16 */
17export declare type RawHttpHeaders = {
18 [headerName: string]: string;
19};
20/**
21 * A collection of HTTP header key/value pairs.
22 */
23export interface HttpHeadersLike {
24 /**
25 * Set a header in this collection with the provided name and value. The name is
26 * case-insensitive.
27 * @param headerName The name of the header to set. This value is case-insensitive.
28 * @param headerValue The value of the header to set.
29 */
30 set(headerName: string, headerValue: string | number): void;
31 /**
32 * Get the header value for the provided header name, or undefined if no header exists in this
33 * collection with the provided name.
34 * @param headerName The name of the header.
35 */
36 get(headerName: string): string | undefined;
37 /**
38 * Get whether or not this header collection contains a header entry for the provided header name.
39 */
40 contains(headerName: string): boolean;
41 /**
42 * Remove the header with the provided headerName. Return whether or not the header existed and
43 * was removed.
44 * @param headerName The name of the header to remove.
45 */
46 remove(headerName: string): boolean;
47 /**
48 * Get the headers that are contained this collection as an object.
49 */
50 rawHeaders(): RawHttpHeaders;
51 /**
52 * Get the headers that are contained in this collection as an array.
53 */
54 headersArray(): HttpHeader[];
55 /**
56 * Get the header names that are contained in this collection.
57 */
58 headerNames(): string[];
59 /**
60 * Get the header values that are contained in this collection.
61 */
62 headerValues(): string[];
63 /**
64 * Create a deep clone/copy of this HttpHeaders collection.
65 */
66 clone(): HttpHeadersLike;
67 /**
68 * Get the JSON object representation of this HTTP header collection.
69 * The result is the same as `rawHeaders()`.
70 */
71 toJson(): RawHttpHeaders;
72}
73export declare function isHttpHeadersLike(object?: any): object is HttpHeadersLike;
74/**
75 * A collection of HTTP header key/value pairs.
76 */
77export declare class HttpHeaders {
78 private readonly _headersMap;
79 constructor(rawHeaders?: RawHttpHeaders);
80 /**
81 * Set a header in this collection with the provided name and value. The name is
82 * case-insensitive.
83 * @param headerName The name of the header to set. This value is case-insensitive.
84 * @param headerValue The value of the header to set.
85 */
86 set(headerName: string, headerValue: string | number): void;
87 /**
88 * Get the header value for the provided header name, or undefined if no header exists in this
89 * collection with the provided name.
90 * @param headerName The name of the header.
91 */
92 get(headerName: string): string | undefined;
93 /**
94 * Get whether or not this header collection contains a header entry for the provided header name.
95 */
96 contains(headerName: string): boolean;
97 /**
98 * Remove the header with the provided headerName. Return whether or not the header existed and
99 * was removed.
100 * @param headerName The name of the header to remove.
101 */
102 remove(headerName: string): boolean;
103 /**
104 * Get the headers that are contained this collection as an object.
105 */
106 rawHeaders(): RawHttpHeaders;
107 /**
108 * Get the headers that are contained in this collection as an array.
109 */
110 headersArray(): HttpHeader[];
111 /**
112 * Get the header names that are contained in this collection.
113 */
114 headerNames(): string[];
115 /**
116 * Get the header names that are contained in this collection.
117 */
118 headerValues(): string[];
119 /**
120 * Get the JSON object representation of this HTTP header collection.
121 */
122 toJson(): RawHttpHeaders;
123 /**
124 * Get the string representation of this HTTP header collection.
125 */
126 toString(): string;
127 /**
128 * Create a deep clone/copy of this HttpHeaders collection.
129 */
130 clone(): HttpHeaders;
131}
132//# sourceMappingURL=httpHeaders.d.ts.map
\No newline at end of file