|
1
|
|
|
declare module "http" { |
|
2
|
|
|
import * as events from "events"; |
|
3
|
|
|
import * as stream from "stream"; |
|
4
|
|
|
import { URL } from "url"; |
|
5
|
|
|
import { Socket, Server as NetServer } from "net"; |
|
6
|
|
|
|
|
7
|
|
|
// incoming headers will never contain number |
|
8
|
|
|
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> { |
|
9
|
|
|
'accept'?: string; |
|
10
|
|
|
'accept-language'?: string; |
|
11
|
|
|
'accept-patch'?: string; |
|
12
|
|
|
'accept-ranges'?: string; |
|
13
|
|
|
'access-control-allow-credentials'?: string; |
|
14
|
|
|
'access-control-allow-headers'?: string; |
|
15
|
|
|
'access-control-allow-methods'?: string; |
|
16
|
|
|
'access-control-allow-origin'?: string; |
|
17
|
|
|
'access-control-expose-headers'?: string; |
|
18
|
|
|
'access-control-max-age'?: string; |
|
19
|
|
|
'access-control-request-headers'?: string; |
|
20
|
|
|
'access-control-request-method'?: string; |
|
21
|
|
|
'age'?: string; |
|
22
|
|
|
'allow'?: string; |
|
23
|
|
|
'alt-svc'?: string; |
|
24
|
|
|
'authorization'?: string; |
|
25
|
|
|
'cache-control'?: string; |
|
26
|
|
|
'connection'?: string; |
|
27
|
|
|
'content-disposition'?: string; |
|
28
|
|
|
'content-encoding'?: string; |
|
29
|
|
|
'content-language'?: string; |
|
30
|
|
|
'content-length'?: string; |
|
31
|
|
|
'content-location'?: string; |
|
32
|
|
|
'content-range'?: string; |
|
33
|
|
|
'content-type'?: string; |
|
34
|
|
|
'cookie'?: string; |
|
35
|
|
|
'date'?: string; |
|
36
|
|
|
'expect'?: string; |
|
37
|
|
|
'expires'?: string; |
|
38
|
|
|
'forwarded'?: string; |
|
39
|
|
|
'from'?: string; |
|
40
|
|
|
'host'?: string; |
|
41
|
|
|
'if-match'?: string; |
|
42
|
|
|
'if-modified-since'?: string; |
|
43
|
|
|
'if-none-match'?: string; |
|
44
|
|
|
'if-unmodified-since'?: string; |
|
45
|
|
|
'last-modified'?: string; |
|
46
|
|
|
'location'?: string; |
|
47
|
|
|
'origin'?: string; |
|
48
|
|
|
'pragma'?: string; |
|
49
|
|
|
'proxy-authenticate'?: string; |
|
50
|
|
|
'proxy-authorization'?: string; |
|
51
|
|
|
'public-key-pins'?: string; |
|
52
|
|
|
'range'?: string; |
|
53
|
|
|
'referer'?: string; |
|
54
|
|
|
'retry-after'?: string; |
|
55
|
|
|
'set-cookie'?: string[]; |
|
56
|
|
|
'strict-transport-security'?: string; |
|
57
|
|
|
'tk'?: string; |
|
58
|
|
|
'trailer'?: string; |
|
59
|
|
|
'transfer-encoding'?: string; |
|
60
|
|
|
'upgrade'?: string; |
|
61
|
|
|
'user-agent'?: string; |
|
62
|
|
|
'vary'?: string; |
|
63
|
|
|
'via'?: string; |
|
64
|
|
|
'warning'?: string; |
|
65
|
|
|
'www-authenticate'?: string; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
// outgoing headers allows numbers (as they are converted internally to strings) |
|
69
|
|
|
interface OutgoingHttpHeaders extends NodeJS.Dict<number | string | string[]> { |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
interface ClientRequestArgs { |
|
73
|
|
|
protocol?: string | null; |
|
74
|
|
|
host?: string | null; |
|
75
|
|
|
hostname?: string | null; |
|
76
|
|
|
family?: number; |
|
77
|
|
|
port?: number | string | null; |
|
78
|
|
|
defaultPort?: number | string; |
|
79
|
|
|
localAddress?: string; |
|
80
|
|
|
socketPath?: string; |
|
81
|
|
|
/** |
|
82
|
|
|
* @default 8192 |
|
83
|
|
|
*/ |
|
84
|
|
|
maxHeaderSize?: number; |
|
85
|
|
|
method?: string; |
|
86
|
|
|
path?: string | null; |
|
87
|
|
|
headers?: OutgoingHttpHeaders; |
|
88
|
|
|
auth?: string | null; |
|
89
|
|
|
agent?: Agent | boolean; |
|
90
|
|
|
_defaultAgent?: Agent; |
|
91
|
|
|
timeout?: number; |
|
92
|
|
|
setHost?: boolean; |
|
93
|
|
|
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278 |
|
94
|
|
|
createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
interface ServerOptions { |
|
98
|
|
|
IncomingMessage?: typeof IncomingMessage; |
|
99
|
|
|
ServerResponse?: typeof ServerResponse; |
|
100
|
|
|
/** |
|
101
|
|
|
* Optionally overrides the value of |
|
102
|
|
|
* [`--max-http-header-size`][] for requests received by this server, i.e. |
|
103
|
|
|
* the maximum length of request headers in bytes. |
|
104
|
|
|
* @default 8192 |
|
105
|
|
|
*/ |
|
106
|
|
|
maxHeaderSize?: number; |
|
107
|
|
|
/** |
|
108
|
|
|
* Use an insecure HTTP parser that accepts invalid HTTP headers when true. |
|
109
|
|
|
* Using the insecure parser should be avoided. |
|
110
|
|
|
* See --insecure-http-parser for more information. |
|
111
|
|
|
* @default false |
|
112
|
|
|
*/ |
|
113
|
|
|
insecureHTTPParser?: boolean; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
type RequestListener = (req: IncomingMessage, res: ServerResponse) => void; |
|
117
|
|
|
|
|
118
|
|
|
interface HttpBase { |
|
119
|
|
|
setTimeout(msecs?: number, callback?: () => void): this; |
|
120
|
|
|
setTimeout(callback: () => void): this; |
|
121
|
|
|
/** |
|
122
|
|
|
* Limits maximum incoming headers count. If set to 0, no limit will be applied. |
|
123
|
|
|
* @default 2000 |
|
124
|
|
|
* {@link https://nodejs.org/api/http.html#http_server_maxheaderscount} |
|
125
|
|
|
*/ |
|
126
|
|
|
maxHeadersCount: number | null; |
|
127
|
|
|
timeout: number; |
|
128
|
|
|
/** |
|
129
|
|
|
* Limit the amount of time the parser will wait to receive the complete HTTP headers. |
|
130
|
|
|
* @default 60000 |
|
131
|
|
|
* {@link https://nodejs.org/api/http.html#http_server_headerstimeout} |
|
132
|
|
|
*/ |
|
133
|
|
|
headersTimeout: number; |
|
134
|
|
|
keepAliveTimeout: number; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
interface Server extends HttpBase {} |
|
138
|
|
|
class Server extends NetServer { |
|
139
|
|
|
constructor(requestListener?: RequestListener); |
|
140
|
|
|
constructor(options: ServerOptions, requestListener?: RequestListener); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
// https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js |
|
144
|
|
|
class OutgoingMessage extends stream.Writable { |
|
145
|
|
|
upgrading: boolean; |
|
146
|
|
|
chunkedEncoding: boolean; |
|
147
|
|
|
shouldKeepAlive: boolean; |
|
148
|
|
|
useChunkedEncodingByDefault: boolean; |
|
149
|
|
|
sendDate: boolean; |
|
150
|
|
|
/** |
|
151
|
|
|
* @deprecated Use `writableEnded` instead. |
|
152
|
|
|
*/ |
|
153
|
|
|
finished: boolean; |
|
154
|
|
|
headersSent: boolean; |
|
155
|
|
|
/** |
|
156
|
|
|
* @deprecate Use `socket` instead. |
|
157
|
|
|
*/ |
|
158
|
|
|
connection: Socket; |
|
159
|
|
|
socket: Socket; |
|
160
|
|
|
|
|
161
|
|
|
constructor(); |
|
162
|
|
|
|
|
163
|
|
|
setTimeout(msecs: number, callback?: () => void): this; |
|
164
|
|
|
setHeader(name: string, value: number | string | string[]): void; |
|
165
|
|
|
getHeader(name: string): number | string | string[] | undefined; |
|
166
|
|
|
getHeaders(): OutgoingHttpHeaders; |
|
167
|
|
|
getHeaderNames(): string[]; |
|
168
|
|
|
hasHeader(name: string): boolean; |
|
169
|
|
|
removeHeader(name: string): void; |
|
170
|
|
|
addTrailers(headers: OutgoingHttpHeaders | Array<[string, string]>): void; |
|
171
|
|
|
flushHeaders(): void; |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
// https://github.com/nodejs/node/blob/master/lib/_http_server.js#L108-L256 |
|
175
|
|
|
class ServerResponse extends OutgoingMessage { |
|
176
|
|
|
statusCode: number; |
|
177
|
|
|
statusMessage: string; |
|
178
|
|
|
|
|
179
|
|
|
constructor(req: IncomingMessage); |
|
180
|
|
|
|
|
181
|
|
|
assignSocket(socket: Socket): void; |
|
182
|
|
|
detachSocket(socket: Socket): void; |
|
183
|
|
|
// https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53 |
|
184
|
|
|
// no args in writeContinue callback |
|
185
|
|
|
writeContinue(callback?: () => void): void; |
|
186
|
|
|
writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders): this; |
|
187
|
|
|
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; |
|
188
|
|
|
writeProcessing(): void; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
interface InformationEvent { |
|
192
|
|
|
statusCode: number; |
|
193
|
|
|
statusMessage: string; |
|
194
|
|
|
httpVersion: string; |
|
195
|
|
|
httpVersionMajor: number; |
|
196
|
|
|
httpVersionMinor: number; |
|
197
|
|
|
headers: IncomingHttpHeaders; |
|
198
|
|
|
rawHeaders: string[]; |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77 |
|
202
|
|
|
class ClientRequest extends OutgoingMessage { |
|
203
|
|
|
connection: Socket; |
|
204
|
|
|
socket: Socket; |
|
205
|
|
|
aborted: number; |
|
206
|
|
|
|
|
207
|
|
|
constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); |
|
208
|
|
|
|
|
209
|
|
|
method: string; |
|
210
|
|
|
path: string; |
|
211
|
|
|
abort(): void; |
|
212
|
|
|
onSocket(socket: Socket): void; |
|
213
|
|
|
setTimeout(timeout: number, callback?: () => void): this; |
|
214
|
|
|
setNoDelay(noDelay?: boolean): void; |
|
215
|
|
|
setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; |
|
216
|
|
|
|
|
217
|
|
|
addListener(event: 'abort', listener: () => void): this; |
|
218
|
|
|
addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
219
|
|
|
addListener(event: 'continue', listener: () => void): this; |
|
220
|
|
|
addListener(event: 'information', listener: (info: InformationEvent) => void): this; |
|
221
|
|
|
addListener(event: 'response', listener: (response: IncomingMessage) => void): this; |
|
222
|
|
|
addListener(event: 'socket', listener: (socket: Socket) => void): this; |
|
223
|
|
|
addListener(event: 'timeout', listener: () => void): this; |
|
224
|
|
|
addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
225
|
|
|
addListener(event: 'close', listener: () => void): this; |
|
226
|
|
|
addListener(event: 'drain', listener: () => void): this; |
|
227
|
|
|
addListener(event: 'error', listener: (err: Error) => void): this; |
|
228
|
|
|
addListener(event: 'finish', listener: () => void): this; |
|
229
|
|
|
addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; |
|
230
|
|
|
addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; |
|
231
|
|
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this; |
|
232
|
|
|
|
|
233
|
|
|
on(event: 'abort', listener: () => void): this; |
|
234
|
|
|
on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
235
|
|
|
on(event: 'continue', listener: () => void): this; |
|
236
|
|
|
on(event: 'information', listener: (info: InformationEvent) => void): this; |
|
237
|
|
|
on(event: 'response', listener: (response: IncomingMessage) => void): this; |
|
238
|
|
|
on(event: 'socket', listener: (socket: Socket) => void): this; |
|
239
|
|
|
on(event: 'timeout', listener: () => void): this; |
|
240
|
|
|
on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
241
|
|
|
on(event: 'close', listener: () => void): this; |
|
242
|
|
|
on(event: 'drain', listener: () => void): this; |
|
243
|
|
|
on(event: 'error', listener: (err: Error) => void): this; |
|
244
|
|
|
on(event: 'finish', listener: () => void): this; |
|
245
|
|
|
on(event: 'pipe', listener: (src: stream.Readable) => void): this; |
|
246
|
|
|
on(event: 'unpipe', listener: (src: stream.Readable) => void): this; |
|
247
|
|
|
on(event: string | symbol, listener: (...args: any[]) => void): this; |
|
248
|
|
|
|
|
249
|
|
|
once(event: 'abort', listener: () => void): this; |
|
250
|
|
|
once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
251
|
|
|
once(event: 'continue', listener: () => void): this; |
|
252
|
|
|
once(event: 'information', listener: (info: InformationEvent) => void): this; |
|
253
|
|
|
once(event: 'response', listener: (response: IncomingMessage) => void): this; |
|
254
|
|
|
once(event: 'socket', listener: (socket: Socket) => void): this; |
|
255
|
|
|
once(event: 'timeout', listener: () => void): this; |
|
256
|
|
|
once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
257
|
|
|
once(event: 'close', listener: () => void): this; |
|
258
|
|
|
once(event: 'drain', listener: () => void): this; |
|
259
|
|
|
once(event: 'error', listener: (err: Error) => void): this; |
|
260
|
|
|
once(event: 'finish', listener: () => void): this; |
|
261
|
|
|
once(event: 'pipe', listener: (src: stream.Readable) => void): this; |
|
262
|
|
|
once(event: 'unpipe', listener: (src: stream.Readable) => void): this; |
|
263
|
|
|
once(event: string | symbol, listener: (...args: any[]) => void): this; |
|
264
|
|
|
|
|
265
|
|
|
prependListener(event: 'abort', listener: () => void): this; |
|
266
|
|
|
prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
267
|
|
|
prependListener(event: 'continue', listener: () => void): this; |
|
268
|
|
|
prependListener(event: 'information', listener: (info: InformationEvent) => void): this; |
|
269
|
|
|
prependListener(event: 'response', listener: (response: IncomingMessage) => void): this; |
|
270
|
|
|
prependListener(event: 'socket', listener: (socket: Socket) => void): this; |
|
271
|
|
|
prependListener(event: 'timeout', listener: () => void): this; |
|
272
|
|
|
prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
273
|
|
|
prependListener(event: 'close', listener: () => void): this; |
|
274
|
|
|
prependListener(event: 'drain', listener: () => void): this; |
|
275
|
|
|
prependListener(event: 'error', listener: (err: Error) => void): this; |
|
276
|
|
|
prependListener(event: 'finish', listener: () => void): this; |
|
277
|
|
|
prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; |
|
278
|
|
|
prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; |
|
279
|
|
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this; |
|
280
|
|
|
|
|
281
|
|
|
prependOnceListener(event: 'abort', listener: () => void): this; |
|
282
|
|
|
prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
283
|
|
|
prependOnceListener(event: 'continue', listener: () => void): this; |
|
284
|
|
|
prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this; |
|
285
|
|
|
prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this; |
|
286
|
|
|
prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this; |
|
287
|
|
|
prependOnceListener(event: 'timeout', listener: () => void): this; |
|
288
|
|
|
prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; |
|
289
|
|
|
prependOnceListener(event: 'close', listener: () => void): this; |
|
290
|
|
|
prependOnceListener(event: 'drain', listener: () => void): this; |
|
291
|
|
|
prependOnceListener(event: 'error', listener: (err: Error) => void): this; |
|
292
|
|
|
prependOnceListener(event: 'finish', listener: () => void): this; |
|
293
|
|
|
prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; |
|
294
|
|
|
prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; |
|
295
|
|
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
class IncomingMessage extends stream.Readable { |
|
299
|
|
|
constructor(socket: Socket); |
|
300
|
|
|
|
|
301
|
|
|
aborted: boolean; |
|
302
|
|
|
httpVersion: string; |
|
303
|
|
|
httpVersionMajor: number; |
|
304
|
|
|
httpVersionMinor: number; |
|
305
|
|
|
complete: boolean; |
|
306
|
|
|
/** |
|
307
|
|
|
* @deprecate Use `socket` instead. |
|
308
|
|
|
*/ |
|
309
|
|
|
connection: Socket; |
|
310
|
|
|
socket: Socket; |
|
311
|
|
|
headers: IncomingHttpHeaders; |
|
312
|
|
|
rawHeaders: string[]; |
|
313
|
|
|
trailers: NodeJS.Dict<string>; |
|
314
|
|
|
rawTrailers: string[]; |
|
315
|
|
|
setTimeout(msecs: number, callback?: () => void): this; |
|
316
|
|
|
/** |
|
317
|
|
|
* Only valid for request obtained from http.Server. |
|
318
|
|
|
*/ |
|
319
|
|
|
method?: string; |
|
320
|
|
|
/** |
|
321
|
|
|
* Only valid for request obtained from http.Server. |
|
322
|
|
|
*/ |
|
323
|
|
|
url?: string; |
|
324
|
|
|
/** |
|
325
|
|
|
* Only valid for response obtained from http.ClientRequest. |
|
326
|
|
|
*/ |
|
327
|
|
|
statusCode?: number; |
|
328
|
|
|
/** |
|
329
|
|
|
* Only valid for response obtained from http.ClientRequest. |
|
330
|
|
|
*/ |
|
331
|
|
|
statusMessage?: string; |
|
332
|
|
|
destroy(error?: Error): void; |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
interface AgentOptions { |
|
336
|
|
|
/** |
|
337
|
|
|
* Keep sockets around in a pool to be used by other requests in the future. Default = false |
|
338
|
|
|
*/ |
|
339
|
|
|
keepAlive?: boolean; |
|
340
|
|
|
/** |
|
341
|
|
|
* When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. |
|
342
|
|
|
* Only relevant if keepAlive is set to true. |
|
343
|
|
|
*/ |
|
344
|
|
|
keepAliveMsecs?: number; |
|
345
|
|
|
/** |
|
346
|
|
|
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity |
|
347
|
|
|
*/ |
|
348
|
|
|
maxSockets?: number; |
|
349
|
|
|
/** |
|
350
|
|
|
* Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. |
|
351
|
|
|
*/ |
|
352
|
|
|
maxFreeSockets?: number; |
|
353
|
|
|
/** |
|
354
|
|
|
* Socket timeout in milliseconds. This will set the timeout after the socket is connected. |
|
355
|
|
|
*/ |
|
356
|
|
|
timeout?: number; |
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
class Agent { |
|
360
|
|
|
maxFreeSockets: number; |
|
361
|
|
|
maxSockets: number; |
|
362
|
|
|
readonly freeSockets: NodeJS.ReadOnlyDict<Socket[]>; |
|
363
|
|
|
readonly sockets: NodeJS.ReadOnlyDict<Socket[]>; |
|
364
|
|
|
readonly requests: NodeJS.ReadOnlyDict<IncomingMessage[]>; |
|
365
|
|
|
|
|
366
|
|
|
constructor(opts?: AgentOptions); |
|
367
|
|
|
|
|
368
|
|
|
/** |
|
369
|
|
|
* Destroy any sockets that are currently in use by the agent. |
|
370
|
|
|
* It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, |
|
371
|
|
|
* then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, |
|
372
|
|
|
* sockets may hang open for quite a long time before the server terminates them. |
|
373
|
|
|
*/ |
|
374
|
|
|
destroy(): void; |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
const METHODS: string[]; |
|
378
|
|
|
|
|
379
|
|
|
const STATUS_CODES: { |
|
380
|
|
|
[errorCode: number]: string | undefined; |
|
381
|
|
|
[errorCode: string]: string | undefined; |
|
382
|
|
|
}; |
|
383
|
|
|
|
|
384
|
|
|
function createServer(requestListener?: RequestListener): Server; |
|
385
|
|
|
function createServer(options: ServerOptions, requestListener?: RequestListener): Server; |
|
386
|
|
|
|
|
387
|
|
|
// although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, |
|
388
|
|
|
// create interface RequestOptions would make the naming more clear to developers |
|
389
|
|
|
interface RequestOptions extends ClientRequestArgs { } |
|
390
|
|
|
function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; |
|
391
|
|
|
function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; |
|
392
|
|
|
function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; |
|
393
|
|
|
function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; |
|
394
|
|
|
let globalAgent: Agent; |
|
395
|
|
|
|
|
396
|
|
|
/** |
|
397
|
|
|
* Read-only property specifying the maximum allowed size of HTTP headers in bytes. |
|
398
|
|
|
* Defaults to 16KB. Configurable using the [`--max-http-header-size`][] CLI option. |
|
399
|
|
|
*/ |
|
400
|
|
|
const maxHeaderSize: number; |
|
401
|
|
|
} |
|
402
|
|
|
|