@types/node 18.16.3 → 20.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert.d.ts +71 -75
- node/async_hooks.d.ts +62 -42
- node/buffer.d.ts +127 -99
- node/child_process.d.ts +50 -54
- node/cluster.d.ts +12 -12
- node/console.d.ts +5 -5
- node/crypto.d.ts +209 -220
- node/dgram.d.ts +15 -15
- node/diagnostics_channel.d.ts +25 -26
- node/dns/promises.d.ts +6 -6
- node/dns.d.ts +24 -16
- node/domain.d.ts +4 -4
- node/events.d.ts +60 -60
- node/fs/promises.d.ts +78 -48
- node/fs.d.ts +117 -81
- node/http.d.ts +158 -147
- node/http2.d.ts +42 -46
- node/https.d.ts +52 -153
- node/index.d.ts +1 -1
- node/inspector.d.ts +10 -3
- node/module.d.ts +5 -4
- node/net.d.ts +21 -18
- node/os.d.ts +22 -18
- node/package.json +2 -2
- node/path.d.ts +4 -4
- node/perf_hooks.d.ts +28 -15
- node/process.d.ts +43 -46
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +5 -5
- node/readline/promises.d.ts +6 -4
- node/readline.d.ts +15 -15
- node/repl.d.ts +9 -9
- node/stream/consumers.d.ts +1 -1
- node/stream.d.ts +88 -136
- node/string_decoder.d.ts +6 -6
- node/test.d.ts +423 -186
- node/timers/promises.d.ts +3 -3
- node/timers.d.ts +2 -2
- node/tls.d.ts +24 -16
- node/trace_events.d.ts +20 -9
- node/ts4.8/assert.d.ts +71 -75
- node/ts4.8/async_hooks.d.ts +62 -42
- node/ts4.8/buffer.d.ts +127 -99
- node/ts4.8/child_process.d.ts +50 -54
- node/ts4.8/cluster.d.ts +12 -12
- node/ts4.8/console.d.ts +5 -5
- node/ts4.8/crypto.d.ts +209 -220
- node/ts4.8/dgram.d.ts +15 -15
- node/ts4.8/diagnostics_channel.d.ts +25 -26
- node/ts4.8/dns/promises.d.ts +6 -6
- node/ts4.8/dns.d.ts +24 -16
- node/ts4.8/domain.d.ts +4 -4
- node/ts4.8/events.d.ts +60 -60
- node/ts4.8/fs/promises.d.ts +96 -45
- node/ts4.8/fs.d.ts +203 -67
- node/ts4.8/globals.d.ts +29 -28
- node/ts4.8/http.d.ts +198 -126
- node/ts4.8/http2.d.ts +42 -46
- node/ts4.8/https.d.ts +52 -153
- node/ts4.8/inspector.d.ts +10 -3
- node/ts4.8/module.d.ts +5 -4
- node/ts4.8/net.d.ts +24 -21
- node/ts4.8/os.d.ts +22 -18
- node/ts4.8/path.d.ts +4 -4
- node/ts4.8/perf_hooks.d.ts +28 -15
- node/ts4.8/process.d.ts +43 -46
- node/ts4.8/punycode.d.ts +1 -1
- node/ts4.8/querystring.d.ts +5 -5
- node/ts4.8/readline/promises.d.ts +6 -4
- node/ts4.8/readline.d.ts +15 -15
- node/ts4.8/repl.d.ts +9 -9
- node/ts4.8/stream/consumers.d.ts +1 -1
- node/ts4.8/stream.d.ts +91 -139
- node/ts4.8/string_decoder.d.ts +6 -6
- node/ts4.8/test.d.ts +423 -186
- node/ts4.8/timers/promises.d.ts +3 -3
- node/ts4.8/timers.d.ts +9 -2
- node/ts4.8/tls.d.ts +24 -16
- node/ts4.8/trace_events.d.ts +20 -9
- node/ts4.8/tty.d.ts +4 -5
- node/ts4.8/url.d.ts +26 -36
- node/ts4.8/util.d.ts +143 -116
- node/ts4.8/v8.d.ts +110 -16
- node/ts4.8/vm.d.ts +292 -42
- node/ts4.8/wasi.d.ts +13 -19
- node/ts4.8/worker_threads.d.ts +32 -34
- node/ts4.8/zlib.d.ts +11 -11
- node/tty.d.ts +4 -5
- node/url.d.ts +26 -36
- node/util.d.ts +146 -111
- node/v8.d.ts +110 -16
- node/vm.d.ts +292 -42
- node/wasi.d.ts +13 -19
- node/worker_threads.d.ts +32 -34
- node/zlib.d.ts +11 -11
node/http.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* To use the HTTP server and client one must `require('http')`.
|
|
2
|
+
* To use the HTTP server and client one must `require('node:http')`.
|
|
3
3
|
*
|
|
4
4
|
* The HTTP interfaces in Node.js are designed to support many features
|
|
5
5
|
* of the protocol which have been traditionally difficult to use.
|
|
@@ -37,13 +37,14 @@
|
|
|
37
37
|
* 'Host', 'example.com',
|
|
38
38
|
* 'accepT', '*' ]
|
|
39
39
|
* ```
|
|
40
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
40
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.1.0/lib/http.js)
|
|
41
41
|
*/
|
|
42
42
|
declare module 'http' {
|
|
43
43
|
import * as stream from 'node:stream';
|
|
44
44
|
import { URL } from 'node:url';
|
|
45
|
-
import { TcpSocketConnectOpts, Socket, Server as NetServer, LookupFunction } from 'node:net';
|
|
46
45
|
import { LookupOptions } from 'node:dns';
|
|
46
|
+
import { EventEmitter } from 'node:events';
|
|
47
|
+
import { TcpSocketConnectOpts, Socket, Server as NetServer, LookupFunction } from 'node:net';
|
|
47
48
|
// incoming headers will never contain number
|
|
48
49
|
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
|
|
49
50
|
accept?: string | undefined;
|
|
@@ -184,6 +185,13 @@ declare module 'http' {
|
|
|
184
185
|
* @default 30000
|
|
185
186
|
*/
|
|
186
187
|
connectionsCheckingInterval?: number | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
|
|
190
|
+
* This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`.
|
|
191
|
+
* Default: @see stream.getDefaultHighWaterMark().
|
|
192
|
+
* @since v20.1.0
|
|
193
|
+
*/
|
|
194
|
+
highWaterMark?: number | undefined;
|
|
187
195
|
/**
|
|
188
196
|
* Use an insecure HTTP parser that accepts invalid HTTP headers when `true`.
|
|
189
197
|
* Using the insecure parser should be avoided.
|
|
@@ -329,7 +337,8 @@ declare module 'http' {
|
|
|
329
337
|
*/
|
|
330
338
|
closeAllConnections(): void;
|
|
331
339
|
/**
|
|
332
|
-
* Closes all connections connected to this server which are not sending a request
|
|
340
|
+
* Closes all connections connected to this server which are not sending a request
|
|
341
|
+
* or waiting for a response.
|
|
333
342
|
* @since v18.2.0
|
|
334
343
|
*/
|
|
335
344
|
closeIdleConnections(): void;
|
|
@@ -341,16 +350,10 @@ declare module 'http' {
|
|
|
341
350
|
addListener(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
|
|
342
351
|
addListener(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
|
|
343
352
|
addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
344
|
-
addListener(
|
|
345
|
-
event: 'connect',
|
|
346
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
347
|
-
): this;
|
|
353
|
+
addListener(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
348
354
|
addListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
|
349
355
|
addListener(event: 'request', listener: RequestListener<Request, Response>): this;
|
|
350
|
-
addListener(
|
|
351
|
-
event: 'upgrade',
|
|
352
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
353
|
-
): this;
|
|
356
|
+
addListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
354
357
|
emit(event: string, ...args: any[]): boolean;
|
|
355
358
|
emit(event: 'close'): boolean;
|
|
356
359
|
emit(event: 'connection', socket: Socket): boolean;
|
|
@@ -395,16 +398,10 @@ declare module 'http' {
|
|
|
395
398
|
once(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
|
|
396
399
|
once(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
|
|
397
400
|
once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
398
|
-
once(
|
|
399
|
-
event: 'connect',
|
|
400
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
401
|
-
): this;
|
|
401
|
+
once(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
402
402
|
once(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
|
403
403
|
once(event: 'request', listener: RequestListener<Request, Response>): this;
|
|
404
|
-
once(
|
|
405
|
-
event: 'upgrade',
|
|
406
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
407
|
-
): this;
|
|
404
|
+
once(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
408
405
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
409
406
|
prependListener(event: 'close', listener: () => void): this;
|
|
410
407
|
prependListener(event: 'connection', listener: (socket: Socket) => void): this;
|
|
@@ -413,19 +410,10 @@ declare module 'http' {
|
|
|
413
410
|
prependListener(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
|
|
414
411
|
prependListener(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
|
|
415
412
|
prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
416
|
-
prependListener(
|
|
417
|
-
|
|
418
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
419
|
-
): this;
|
|
420
|
-
prependListener(
|
|
421
|
-
event: 'dropRequest',
|
|
422
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
|
|
423
|
-
): this;
|
|
413
|
+
prependListener(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
414
|
+
prependListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
|
424
415
|
prependListener(event: 'request', listener: RequestListener<Request, Response>): this;
|
|
425
|
-
prependListener(
|
|
426
|
-
event: 'upgrade',
|
|
427
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
428
|
-
): this;
|
|
416
|
+
prependListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
429
417
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
430
418
|
prependOnceListener(event: 'close', listener: () => void): this;
|
|
431
419
|
prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
|
|
@@ -434,23 +422,14 @@ declare module 'http' {
|
|
|
434
422
|
prependOnceListener(event: 'checkContinue', listener: RequestListener<Request, Response>): this;
|
|
435
423
|
prependOnceListener(event: 'checkExpectation', listener: RequestListener<Request, Response>): this;
|
|
436
424
|
prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
437
|
-
prependOnceListener(
|
|
438
|
-
|
|
439
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
440
|
-
): this;
|
|
441
|
-
prependOnceListener(
|
|
442
|
-
event: 'dropRequest',
|
|
443
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
|
|
444
|
-
): this;
|
|
425
|
+
prependOnceListener(event: 'connect', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
426
|
+
prependOnceListener(event: 'dropRequest', listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
|
445
427
|
prependOnceListener(event: 'request', listener: RequestListener<Request, Response>): this;
|
|
446
|
-
prependOnceListener(
|
|
447
|
-
event: 'upgrade',
|
|
448
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
449
|
-
): this;
|
|
428
|
+
prependOnceListener(event: 'upgrade', listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
450
429
|
}
|
|
451
430
|
/**
|
|
452
|
-
* This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract
|
|
453
|
-
* the perspective of the participants of HTTP transaction.
|
|
431
|
+
* This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from
|
|
432
|
+
* the perspective of the participants of an HTTP transaction.
|
|
454
433
|
* @since v0.1.17
|
|
455
434
|
*/
|
|
456
435
|
class OutgoingMessage<Request extends IncomingMessage = IncomingMessage> extends stream.Writable {
|
|
@@ -469,7 +448,7 @@ declare module 'http' {
|
|
|
469
448
|
*/
|
|
470
449
|
readonly headersSent: boolean;
|
|
471
450
|
/**
|
|
472
|
-
*
|
|
451
|
+
* Alias of `outgoingMessage.socket`.
|
|
473
452
|
* @since v0.3.0
|
|
474
453
|
* @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead.
|
|
475
454
|
*/
|
|
@@ -490,8 +469,9 @@ declare module 'http' {
|
|
|
490
469
|
*/
|
|
491
470
|
setTimeout(msecs: number, callback?: () => void): this;
|
|
492
471
|
/**
|
|
493
|
-
* Sets a single header value
|
|
494
|
-
*
|
|
472
|
+
* Sets a single header value. If the header already exists in the to-be-sent
|
|
473
|
+
* headers, its value will be replaced. Use an array of strings to send multiple
|
|
474
|
+
* headers with the same name.
|
|
495
475
|
* @since v0.4.0
|
|
496
476
|
* @param name Header name
|
|
497
477
|
* @param value Header value
|
|
@@ -500,20 +480,22 @@ declare module 'http' {
|
|
|
500
480
|
/**
|
|
501
481
|
* Append a single header value for the header object.
|
|
502
482
|
*
|
|
503
|
-
* If the value is an array, this is equivalent of calling this method multiple
|
|
483
|
+
* If the value is an array, this is equivalent of calling this method multiple
|
|
484
|
+
* times.
|
|
504
485
|
*
|
|
505
486
|
* If there were no previous value for the header, this is equivalent of calling `outgoingMessage.setHeader(name, value)`.
|
|
506
487
|
*
|
|
507
|
-
* Depending of the value of `options.uniqueHeaders` when the client request or the
|
|
508
|
-
* this will end up in the header being sent multiple times or
|
|
488
|
+
* Depending of the value of `options.uniqueHeaders` when the client request or the
|
|
489
|
+
* server were created, this will end up in the header being sent multiple times or
|
|
490
|
+
* a single time with values joined using `; `.
|
|
509
491
|
* @since v18.3.0, v16.17.0
|
|
510
492
|
* @param name Header name
|
|
511
493
|
* @param value Header value
|
|
512
494
|
*/
|
|
513
495
|
appendHeader(name: string, value: string | ReadonlyArray<string>): this;
|
|
514
496
|
/**
|
|
515
|
-
* Gets the value of HTTP header with the given name. If
|
|
516
|
-
*
|
|
497
|
+
* Gets the value of the HTTP header with the given name. If that header is not
|
|
498
|
+
* set, the returned value will be `undefined`.
|
|
517
499
|
* @since v0.4.0
|
|
518
500
|
* @param name Name of header
|
|
519
501
|
*/
|
|
@@ -526,8 +508,8 @@ declare module 'http' {
|
|
|
526
508
|
* values. All header names are lowercase.
|
|
527
509
|
*
|
|
528
510
|
* The object returned by the `outgoingMessage.getHeaders()` method does
|
|
529
|
-
* not prototypically inherit from the JavaScript Object
|
|
530
|
-
* typical Object methods such as `obj.toString()`, `obj.hasOwnProperty()`,
|
|
511
|
+
* not prototypically inherit from the JavaScript `Object`. This means that
|
|
512
|
+
* typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`,
|
|
531
513
|
* and others are not defined and will not work.
|
|
532
514
|
*
|
|
533
515
|
* ```js
|
|
@@ -541,8 +523,8 @@ declare module 'http' {
|
|
|
541
523
|
*/
|
|
542
524
|
getHeaders(): OutgoingHttpHeaders;
|
|
543
525
|
/**
|
|
544
|
-
* Returns an array
|
|
545
|
-
* names are lowercase.
|
|
526
|
+
* Returns an array containing the unique names of the current outgoing headers.
|
|
527
|
+
* All names are lowercase.
|
|
546
528
|
* @since v7.7.0
|
|
547
529
|
*/
|
|
548
530
|
getHeaderNames(): string[];
|
|
@@ -569,11 +551,11 @@ declare module 'http' {
|
|
|
569
551
|
/**
|
|
570
552
|
* Adds HTTP trailers (headers but at the end of the message) to the message.
|
|
571
553
|
*
|
|
572
|
-
* Trailers
|
|
573
|
-
* the
|
|
554
|
+
* Trailers will **only** be emitted if the message is chunked encoded. If not,
|
|
555
|
+
* the trailers will be silently discarded.
|
|
574
556
|
*
|
|
575
557
|
* HTTP requires the `Trailer` header to be sent to emit trailers,
|
|
576
|
-
* with a list of header
|
|
558
|
+
* with a list of header field names in its value, e.g.
|
|
577
559
|
*
|
|
578
560
|
* ```js
|
|
579
561
|
* message.writeHead(200, { 'Content-Type': 'text/plain',
|
|
@@ -589,7 +571,7 @@ declare module 'http' {
|
|
|
589
571
|
*/
|
|
590
572
|
addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
|
|
591
573
|
/**
|
|
592
|
-
*
|
|
574
|
+
* Flushes the message headers.
|
|
593
575
|
*
|
|
594
576
|
* For efficiency reason, Node.js normally buffers the message headers
|
|
595
577
|
* until `outgoingMessage.end()` is called or the first chunk of message data
|
|
@@ -597,7 +579,7 @@ declare module 'http' {
|
|
|
597
579
|
* packet.
|
|
598
580
|
*
|
|
599
581
|
* It is usually desired (it saves a TCP round-trip), but not when the first
|
|
600
|
-
* data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the
|
|
582
|
+
* data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the message.
|
|
601
583
|
* @since v1.6.0
|
|
602
584
|
*/
|
|
603
585
|
flushHeaders(): void;
|
|
@@ -638,10 +620,9 @@ declare module 'http' {
|
|
|
638
620
|
*/
|
|
639
621
|
statusMessage: string;
|
|
640
622
|
/**
|
|
641
|
-
* If set to `true`, Node.js will check whether the `Content-Length`
|
|
642
|
-
*
|
|
643
|
-
*
|
|
644
|
-
* identified by `code: 'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
|
|
623
|
+
* If set to `true`, Node.js will check whether the `Content-Length`header value and the size of the body, in bytes, are equal.
|
|
624
|
+
* Mismatching the `Content-Length` header value will result
|
|
625
|
+
* in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
|
|
645
626
|
* @since v18.10.0, v16.18.0
|
|
646
627
|
*/
|
|
647
628
|
strictContentLength: boolean;
|
|
@@ -661,7 +642,7 @@ declare module 'http' {
|
|
|
661
642
|
* early hints message. The optional `callback` argument will be called when
|
|
662
643
|
* the response message has been written.
|
|
663
644
|
*
|
|
664
|
-
* Example
|
|
645
|
+
* **Example**
|
|
665
646
|
*
|
|
666
647
|
* ```js
|
|
667
648
|
* const earlyHintsLink = '</styles.css>; rel=preload; as=style';
|
|
@@ -675,15 +656,14 @@ declare module 'http' {
|
|
|
675
656
|
* ];
|
|
676
657
|
* response.writeEarlyHints({
|
|
677
658
|
* 'link': earlyHintsLinks,
|
|
678
|
-
* 'x-trace-id': 'id for diagnostics'
|
|
659
|
+
* 'x-trace-id': 'id for diagnostics',
|
|
679
660
|
* });
|
|
680
661
|
*
|
|
681
662
|
* const earlyHintsCallback = () => console.log('early hints message sent');
|
|
682
663
|
* response.writeEarlyHints({
|
|
683
|
-
* 'link': earlyHintsLinks
|
|
664
|
+
* 'link': earlyHintsLinks,
|
|
684
665
|
* }, earlyHintsCallback);
|
|
685
666
|
* ```
|
|
686
|
-
*
|
|
687
667
|
* @since v18.11.0
|
|
688
668
|
* @param hints An object containing the values of headers
|
|
689
669
|
* @param callback Will be called when the response message has been written
|
|
@@ -707,7 +687,7 @@ declare module 'http' {
|
|
|
707
687
|
* response
|
|
708
688
|
* .writeHead(200, {
|
|
709
689
|
* 'Content-Length': Buffer.byteLength(body),
|
|
710
|
-
* 'Content-Type': 'text/plain'
|
|
690
|
+
* 'Content-Type': 'text/plain',
|
|
711
691
|
* })
|
|
712
692
|
* .end(body);
|
|
713
693
|
* ```
|
|
@@ -738,12 +718,12 @@ declare module 'http' {
|
|
|
738
718
|
* });
|
|
739
719
|
* ```
|
|
740
720
|
*
|
|
741
|
-
* `Content-Length` is
|
|
742
|
-
*
|
|
721
|
+
* `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js
|
|
722
|
+
* will check whether `Content-Length` and the length of the body which has
|
|
743
723
|
* been transmitted are equal or not.
|
|
744
724
|
*
|
|
745
725
|
* Attempting to set a header field name or value that contains invalid characters
|
|
746
|
-
* will result in a `
|
|
726
|
+
* will result in a \[`Error`\]\[\] being thrown.
|
|
747
727
|
* @since v0.1.30
|
|
748
728
|
*/
|
|
749
729
|
writeHead(
|
|
@@ -753,7 +733,7 @@ declare module 'http' {
|
|
|
753
733
|
): this;
|
|
754
734
|
writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
|
|
755
735
|
/**
|
|
756
|
-
* Sends
|
|
736
|
+
* Sends a HTTP/1.1 102 Processing message to the client, indicating that
|
|
757
737
|
* the request body should be sent.
|
|
758
738
|
* @since v10.0.0
|
|
759
739
|
*/
|
|
@@ -792,8 +772,11 @@ declare module 'http' {
|
|
|
792
772
|
*
|
|
793
773
|
* For backward compatibility, `res` will only emit `'error'` if there is an`'error'` listener registered.
|
|
794
774
|
*
|
|
795
|
-
*
|
|
796
|
-
*
|
|
775
|
+
* Set `Content-Length` header to limit the response body size.
|
|
776
|
+
* If `response.strictContentLength` is set to `true`, mismatching the`Content-Length` header value will result in an `Error` being thrown,
|
|
777
|
+
* identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`.
|
|
778
|
+
*
|
|
779
|
+
* `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes.
|
|
797
780
|
* @since v0.1.17
|
|
798
781
|
*/
|
|
799
782
|
class ClientRequest extends OutgoingMessage {
|
|
@@ -820,7 +803,7 @@ declare module 'http' {
|
|
|
820
803
|
* may run into a 'ECONNRESET' error.
|
|
821
804
|
*
|
|
822
805
|
* ```js
|
|
823
|
-
* const http = require('http');
|
|
806
|
+
* const http = require('node:http');
|
|
824
807
|
*
|
|
825
808
|
* // Server has a 5 seconds keep-alive timeout by default
|
|
826
809
|
* http
|
|
@@ -844,7 +827,7 @@ declare module 'http' {
|
|
|
844
827
|
* automatic error retry base on it.
|
|
845
828
|
*
|
|
846
829
|
* ```js
|
|
847
|
-
* const http = require('http');
|
|
830
|
+
* const http = require('node:http');
|
|
848
831
|
* const agent = new http.Agent({ keepAlive: true });
|
|
849
832
|
*
|
|
850
833
|
* function retriableRequest() {
|
|
@@ -923,19 +906,13 @@ declare module 'http' {
|
|
|
923
906
|
* @deprecated
|
|
924
907
|
*/
|
|
925
908
|
addListener(event: 'abort', listener: () => void): this;
|
|
926
|
-
addListener(
|
|
927
|
-
event: 'connect',
|
|
928
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
929
|
-
): this;
|
|
909
|
+
addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
930
910
|
addListener(event: 'continue', listener: () => void): this;
|
|
931
911
|
addListener(event: 'information', listener: (info: InformationEvent) => void): this;
|
|
932
912
|
addListener(event: 'response', listener: (response: IncomingMessage) => void): this;
|
|
933
913
|
addListener(event: 'socket', listener: (socket: Socket) => void): this;
|
|
934
914
|
addListener(event: 'timeout', listener: () => void): this;
|
|
935
|
-
addListener(
|
|
936
|
-
event: 'upgrade',
|
|
937
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
938
|
-
): this;
|
|
915
|
+
addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
939
916
|
addListener(event: 'close', listener: () => void): this;
|
|
940
917
|
addListener(event: 'drain', listener: () => void): this;
|
|
941
918
|
addListener(event: 'error', listener: (err: Error) => void): this;
|
|
@@ -983,19 +960,13 @@ declare module 'http' {
|
|
|
983
960
|
* @deprecated
|
|
984
961
|
*/
|
|
985
962
|
prependListener(event: 'abort', listener: () => void): this;
|
|
986
|
-
prependListener(
|
|
987
|
-
event: 'connect',
|
|
988
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
989
|
-
): this;
|
|
963
|
+
prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
990
964
|
prependListener(event: 'continue', listener: () => void): this;
|
|
991
965
|
prependListener(event: 'information', listener: (info: InformationEvent) => void): this;
|
|
992
966
|
prependListener(event: 'response', listener: (response: IncomingMessage) => void): this;
|
|
993
967
|
prependListener(event: 'socket', listener: (socket: Socket) => void): this;
|
|
994
968
|
prependListener(event: 'timeout', listener: () => void): this;
|
|
995
|
-
prependListener(
|
|
996
|
-
event: 'upgrade',
|
|
997
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
998
|
-
): this;
|
|
969
|
+
prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
999
970
|
prependListener(event: 'close', listener: () => void): this;
|
|
1000
971
|
prependListener(event: 'drain', listener: () => void): this;
|
|
1001
972
|
prependListener(event: 'error', listener: (err: Error) => void): this;
|
|
@@ -1007,19 +978,13 @@ declare module 'http' {
|
|
|
1007
978
|
* @deprecated
|
|
1008
979
|
*/
|
|
1009
980
|
prependOnceListener(event: 'abort', listener: () => void): this;
|
|
1010
|
-
prependOnceListener(
|
|
1011
|
-
event: 'connect',
|
|
1012
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
1013
|
-
): this;
|
|
981
|
+
prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
1014
982
|
prependOnceListener(event: 'continue', listener: () => void): this;
|
|
1015
983
|
prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this;
|
|
1016
984
|
prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this;
|
|
1017
985
|
prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this;
|
|
1018
986
|
prependOnceListener(event: 'timeout', listener: () => void): this;
|
|
1019
|
-
prependOnceListener(
|
|
1020
|
-
event: 'upgrade',
|
|
1021
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
1022
|
-
): this;
|
|
987
|
+
prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
1023
988
|
prependOnceListener(event: 'close', listener: () => void): this;
|
|
1024
989
|
prependOnceListener(event: 'drain', listener: () => void): this;
|
|
1025
990
|
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
|
@@ -1031,7 +996,7 @@ declare module 'http' {
|
|
|
1031
996
|
/**
|
|
1032
997
|
* An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to
|
|
1033
998
|
* access response
|
|
1034
|
-
* status, headers and data.
|
|
999
|
+
* status, headers, and data.
|
|
1035
1000
|
*
|
|
1036
1001
|
* Different from its `socket` value which is a subclass of `stream.Duplex`, the`IncomingMessage` itself extends `stream.Readable` and is created separately to
|
|
1037
1002
|
* parse and emit the incoming HTTP headers and payload, as the underlying socket
|
|
@@ -1069,7 +1034,7 @@ declare module 'http' {
|
|
|
1069
1034
|
* const req = http.request({
|
|
1070
1035
|
* host: '127.0.0.1',
|
|
1071
1036
|
* port: 8080,
|
|
1072
|
-
* method: 'POST'
|
|
1037
|
+
* method: 'POST',
|
|
1073
1038
|
* }, (res) => {
|
|
1074
1039
|
* res.resume();
|
|
1075
1040
|
* res.on('end', () => {
|
|
@@ -1111,7 +1076,7 @@ declare module 'http' {
|
|
|
1111
1076
|
* // { 'user-agent': 'curl/7.22.0',
|
|
1112
1077
|
* // host: '127.0.0.1:8000',
|
|
1113
1078
|
* // accept: '*' }
|
|
1114
|
-
* console.log(request.
|
|
1079
|
+
* console.log(request.headers);
|
|
1115
1080
|
* ```
|
|
1116
1081
|
*
|
|
1117
1082
|
* Duplicates in raw headers are handled in the following ways, depending on the
|
|
@@ -1119,14 +1084,18 @@ declare module 'http' {
|
|
|
1119
1084
|
*
|
|
1120
1085
|
* * Duplicates of `age`, `authorization`, `content-length`, `content-type`,`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,`last-modified`, `location`,
|
|
1121
1086
|
* `max-forwards`, `proxy-authorization`, `referer`,`retry-after`, `server`, or `user-agent` are discarded.
|
|
1087
|
+
* To allow duplicate values of the headers listed above to be joined,
|
|
1088
|
+
* use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more
|
|
1089
|
+
* information.
|
|
1122
1090
|
* * `set-cookie` is always an array. Duplicates are added to the array.
|
|
1123
|
-
* * For duplicate `cookie` headers, the values are joined together with
|
|
1124
|
-
* * For all other headers, the values are joined together with
|
|
1091
|
+
* * For duplicate `cookie` headers, the values are joined together with `; `.
|
|
1092
|
+
* * For all other headers, the values are joined together with `, `.
|
|
1125
1093
|
* @since v0.1.5
|
|
1126
1094
|
*/
|
|
1127
1095
|
headers: IncomingHttpHeaders;
|
|
1128
1096
|
/**
|
|
1129
|
-
* Similar to `message.headers`, but there is no join logic and the values are
|
|
1097
|
+
* Similar to `message.headers`, but there is no join logic and the values are
|
|
1098
|
+
* always arrays of strings, even for headers received just once.
|
|
1130
1099
|
*
|
|
1131
1100
|
* ```js
|
|
1132
1101
|
* // Prints something like:
|
|
@@ -1170,7 +1139,8 @@ declare module 'http' {
|
|
|
1170
1139
|
*/
|
|
1171
1140
|
trailers: NodeJS.Dict<string>;
|
|
1172
1141
|
/**
|
|
1173
|
-
* Similar to `message.trailers`, but there is no join logic and the values are
|
|
1142
|
+
* Similar to `message.trailers`, but there is no join logic and the values are
|
|
1143
|
+
* always arrays of strings, even for headers received just once.
|
|
1174
1144
|
* Only populated at the `'end'` event.
|
|
1175
1145
|
* @since v18.3.0, v16.17.0
|
|
1176
1146
|
*/
|
|
@@ -1207,14 +1177,14 @@ declare module 'http' {
|
|
|
1207
1177
|
* To parse the URL into its parts:
|
|
1208
1178
|
*
|
|
1209
1179
|
* ```js
|
|
1210
|
-
* new URL(request.url, `http://${request.
|
|
1180
|
+
* new URL(request.url, `http://${request.headers.host}`);
|
|
1211
1181
|
* ```
|
|
1212
1182
|
*
|
|
1213
|
-
* When `request.url` is `'/status?name=ryan'` and`request.
|
|
1183
|
+
* When `request.url` is `'/status?name=ryan'` and `request.headers.host` is`'localhost:3000'`:
|
|
1214
1184
|
*
|
|
1215
1185
|
* ```console
|
|
1216
1186
|
* $ node
|
|
1217
|
-
* > new URL(request.url, `http://${request.
|
|
1187
|
+
* > new URL(request.url, `http://${request.headers.host}`)
|
|
1218
1188
|
* URL {
|
|
1219
1189
|
* href: 'http://localhost:3000/status?name=ryan',
|
|
1220
1190
|
* origin: 'http://localhost:3000',
|
|
@@ -1334,16 +1304,16 @@ declare module 'http' {
|
|
|
1334
1304
|
* hostname: 'localhost',
|
|
1335
1305
|
* port: 80,
|
|
1336
1306
|
* path: '/',
|
|
1337
|
-
* agent: false // Create a new agent just for this one request
|
|
1307
|
+
* agent: false, // Create a new agent just for this one request
|
|
1338
1308
|
* }, (res) => {
|
|
1339
1309
|
* // Do stuff with response
|
|
1340
1310
|
* });
|
|
1341
1311
|
* ```
|
|
1342
1312
|
* @since v0.3.4
|
|
1343
1313
|
*/
|
|
1344
|
-
class Agent {
|
|
1314
|
+
class Agent extends EventEmitter {
|
|
1345
1315
|
/**
|
|
1346
|
-
* By default set to 256
|
|
1316
|
+
* By default set to 256. For agents with `keepAlive` enabled, this
|
|
1347
1317
|
* sets the maximum number of sockets that will be left open in the free
|
|
1348
1318
|
* state.
|
|
1349
1319
|
* @since v0.11.7
|
|
@@ -1439,10 +1409,10 @@ declare module 'http' {
|
|
|
1439
1409
|
* upload a file with a POST request, then write to the `ClientRequest` object.
|
|
1440
1410
|
*
|
|
1441
1411
|
* ```js
|
|
1442
|
-
* const http = require('http');
|
|
1412
|
+
* const http = require('node:http');
|
|
1443
1413
|
*
|
|
1444
1414
|
* const postData = JSON.stringify({
|
|
1445
|
-
* 'msg': 'Hello World!'
|
|
1415
|
+
* 'msg': 'Hello World!',
|
|
1446
1416
|
* });
|
|
1447
1417
|
*
|
|
1448
1418
|
* const options = {
|
|
@@ -1452,8 +1422,8 @@ declare module 'http' {
|
|
|
1452
1422
|
* method: 'POST',
|
|
1453
1423
|
* headers: {
|
|
1454
1424
|
* 'Content-Type': 'application/json',
|
|
1455
|
-
* 'Content-Length': Buffer.byteLength(postData)
|
|
1456
|
-
* }
|
|
1425
|
+
* 'Content-Length': Buffer.byteLength(postData),
|
|
1426
|
+
* },
|
|
1457
1427
|
* };
|
|
1458
1428
|
*
|
|
1459
1429
|
* const req = http.request(options, (res) => {
|
|
@@ -1540,7 +1510,7 @@ declare module 'http' {
|
|
|
1540
1510
|
* * `'data'` any number of times, on the `res` object
|
|
1541
1511
|
* * (connection closed here)
|
|
1542
1512
|
* * `'aborted'` on the `res` object
|
|
1543
|
-
* * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'
|
|
1513
|
+
* * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`
|
|
1544
1514
|
* * `'close'`
|
|
1545
1515
|
* * `'close'` on the `res` object
|
|
1546
1516
|
*
|
|
@@ -1548,7 +1518,7 @@ declare module 'http' {
|
|
|
1548
1518
|
* events will be emitted in the following order:
|
|
1549
1519
|
*
|
|
1550
1520
|
* * (`req.destroy()` called here)
|
|
1551
|
-
* * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
|
|
1521
|
+
* * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called
|
|
1552
1522
|
* * `'close'`
|
|
1553
1523
|
*
|
|
1554
1524
|
* If `req.destroy()` is called before the connection succeeds, the following
|
|
@@ -1556,7 +1526,7 @@ declare module 'http' {
|
|
|
1556
1526
|
*
|
|
1557
1527
|
* * `'socket'`
|
|
1558
1528
|
* * (`req.destroy()` called here)
|
|
1559
|
-
* * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`
|
|
1529
|
+
* * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called
|
|
1560
1530
|
* * `'close'`
|
|
1561
1531
|
*
|
|
1562
1532
|
* If `req.destroy()` is called after the response is received, the following
|
|
@@ -1567,7 +1537,7 @@ declare module 'http' {
|
|
|
1567
1537
|
* * `'data'` any number of times, on the `res` object
|
|
1568
1538
|
* * (`req.destroy()` called here)
|
|
1569
1539
|
* * `'aborted'` on the `res` object
|
|
1570
|
-
* * `'error'` on the `res` object with an error with message`'Error: aborted'`
|
|
1540
|
+
* * `'error'` on the `res` object with an error with message `'Error: aborted'`and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
|
|
1571
1541
|
* * `'close'`
|
|
1572
1542
|
* * `'close'` on the `res` object
|
|
1573
1543
|
*
|
|
@@ -1603,16 +1573,13 @@ declare module 'http' {
|
|
|
1603
1573
|
* Setting the `timeout` option or using the `setTimeout()` function will
|
|
1604
1574
|
* not abort the request or do anything besides add a `'timeout'` event.
|
|
1605
1575
|
*
|
|
1606
|
-
* Passing an `AbortSignal` and then calling `abort` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the
|
|
1607
|
-
* request
|
|
1576
|
+
* Passing an `AbortSignal` and then calling `abort()` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the
|
|
1577
|
+
* request. Specifically, the `'error'` event will be emitted with an error with
|
|
1578
|
+
* the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`and the `cause`, if one was provided.
|
|
1608
1579
|
* @since v0.3.6
|
|
1609
1580
|
*/
|
|
1610
1581
|
function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
1611
|
-
function request(
|
|
1612
|
-
url: string | URL,
|
|
1613
|
-
options: RequestOptions,
|
|
1614
|
-
callback?: (res: IncomingMessage) => void,
|
|
1615
|
-
): ClientRequest;
|
|
1582
|
+
function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
1616
1583
|
/**
|
|
1617
1584
|
* Since most requests are GET requests without bodies, Node.js provides this
|
|
1618
1585
|
* convenience method. The only difference between this method and {@link request} is that it sets the method to GET and calls `req.end()`automatically. The callback must take care to consume the
|
|
@@ -1664,7 +1631,7 @@ declare module 'http' {
|
|
|
1664
1631
|
* const server = http.createServer((req, res) => {
|
|
1665
1632
|
* res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1666
1633
|
* res.end(JSON.stringify({
|
|
1667
|
-
* data: 'Hello World!'
|
|
1634
|
+
* data: 'Hello World!',
|
|
1668
1635
|
* }));
|
|
1669
1636
|
* });
|
|
1670
1637
|
*
|
|
@@ -1675,32 +1642,76 @@ declare module 'http' {
|
|
|
1675
1642
|
*/
|
|
1676
1643
|
function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
1677
1644
|
function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
1678
|
-
|
|
1679
1645
|
/**
|
|
1680
|
-
* Performs the low-level validations on the provided name that are done when
|
|
1681
|
-
*
|
|
1682
|
-
*
|
|
1646
|
+
* Performs the low-level validations on the provided `name` that are done when`res.setHeader(name, value)` is called.
|
|
1647
|
+
*
|
|
1648
|
+
* Passing illegal value as `name` will result in a `TypeError` being thrown,
|
|
1649
|
+
* identified by `code: 'ERR_INVALID_HTTP_TOKEN'`.
|
|
1650
|
+
*
|
|
1651
|
+
* It is not necessary to use this method before passing headers to an HTTP request
|
|
1652
|
+
* or response. The HTTP module will automatically validate such headers.
|
|
1653
|
+
* Examples:
|
|
1654
|
+
*
|
|
1655
|
+
* Example:
|
|
1656
|
+
*
|
|
1657
|
+
* ```js
|
|
1658
|
+
* const { validateHeaderName } = require('node:http');
|
|
1659
|
+
*
|
|
1660
|
+
* try {
|
|
1661
|
+
* validateHeaderName('');
|
|
1662
|
+
* } catch (err) {
|
|
1663
|
+
* console.error(err instanceof TypeError); // --> true
|
|
1664
|
+
* console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN'
|
|
1665
|
+
* console.error(err.message); // --> 'Header name must be a valid HTTP token [""]'
|
|
1666
|
+
* }
|
|
1667
|
+
* ```
|
|
1683
1668
|
* @since v14.3.0
|
|
1669
|
+
* @param [label='Header name'] Label for error message.
|
|
1684
1670
|
*/
|
|
1685
1671
|
function validateHeaderName(name: string): void;
|
|
1686
1672
|
/**
|
|
1687
|
-
* Performs the low-level validations on the provided value that are done when
|
|
1688
|
-
*
|
|
1689
|
-
*
|
|
1690
|
-
*
|
|
1673
|
+
* Performs the low-level validations on the provided `value` that are done when`res.setHeader(name, value)` is called.
|
|
1674
|
+
*
|
|
1675
|
+
* Passing illegal value as `value` will result in a `TypeError` being thrown.
|
|
1676
|
+
*
|
|
1677
|
+
* * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`.
|
|
1678
|
+
* * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`.
|
|
1679
|
+
*
|
|
1680
|
+
* It is not necessary to use this method before passing headers to an HTTP request
|
|
1681
|
+
* or response. The HTTP module will automatically validate such headers.
|
|
1682
|
+
*
|
|
1683
|
+
* Examples:
|
|
1684
|
+
*
|
|
1685
|
+
* ```js
|
|
1686
|
+
* const { validateHeaderValue } = require('node:http');
|
|
1687
|
+
*
|
|
1688
|
+
* try {
|
|
1689
|
+
* validateHeaderValue('x-my-header', undefined);
|
|
1690
|
+
* } catch (err) {
|
|
1691
|
+
* console.error(err instanceof TypeError); // --> true
|
|
1692
|
+
* console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true
|
|
1693
|
+
* console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"'
|
|
1694
|
+
* }
|
|
1695
|
+
*
|
|
1696
|
+
* try {
|
|
1697
|
+
* validateHeaderValue('x-my-header', 'oʊmɪɡə');
|
|
1698
|
+
* } catch (err) {
|
|
1699
|
+
* console.error(err instanceof TypeError); // --> true
|
|
1700
|
+
* console.error(err.code === 'ERR_INVALID_CHAR'); // --> true
|
|
1701
|
+
* console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]'
|
|
1702
|
+
* }
|
|
1703
|
+
* ```
|
|
1704
|
+
* @since v14.3.0
|
|
1691
1705
|
* @param name Header name
|
|
1692
1706
|
* @param value Header value
|
|
1693
|
-
* @since v14.3.0
|
|
1694
1707
|
*/
|
|
1695
1708
|
function validateHeaderValue(name: string, value: string): void;
|
|
1696
|
-
|
|
1697
1709
|
/**
|
|
1698
|
-
* Set the maximum number of idle HTTP parsers.
|
|
1699
|
-
* @param count
|
|
1710
|
+
* Set the maximum number of idle HTTP parsers.
|
|
1700
1711
|
* @since v18.8.0, v16.18.0
|
|
1712
|
+
* @param [max=1000]
|
|
1701
1713
|
*/
|
|
1702
|
-
function setMaxIdleHTTPParsers(
|
|
1703
|
-
|
|
1714
|
+
function setMaxIdleHTTPParsers(max: number): void;
|
|
1704
1715
|
let globalAgent: Agent;
|
|
1705
1716
|
/**
|
|
1706
1717
|
* Read-only property specifying the maximum allowed size of HTTP headers in bytes.
|