@idlebox/stripe-node-types 24.0.14-patch.0 → 24.0.15
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.
- package/README.md +1 -1
- package/assert/strict.d.ts +113 -1
- package/assert.d.ts +162 -248
- package/async_hooks.d.ts +20 -5
- package/buffer.buffer.d.ts +24 -6
- package/buffer.d.ts +63 -168
- package/child_process.d.ts +117 -223
- package/cluster.d.ts +251 -329
- package/compatibility/iterators.d.ts +15 -0
- package/console.d.ts +60 -346
- package/constants.d.ts +15 -1
- package/crypto.d.ts +713 -1149
- package/dgram.d.ts +30 -50
- package/diagnostics_channel.d.ts +16 -3
- package/dns/promises.d.ts +15 -0
- package/dns.d.ts +150 -131
- package/domain.d.ts +25 -14
- package/events.d.ts +858 -719
- package/fs/promises.d.ts +117 -53
- package/fs.d.ts +729 -484
- package/globals.d.ts +142 -344
- package/globals.typedarray.d.ts +94 -0
- package/http.d.ts +358 -246
- package/http2.d.ts +578 -711
- package/https.d.ts +85 -216
- package/index.d.ts +39 -3
- package/inspector/promises.d.ts +54 -0
- package/inspector.d.ts +180 -3936
- package/inspector.generated.d.ts +4242 -0
- package/module.d.ts +60 -95
- package/my-shim.d.ts +15 -0
- package/net.d.ts +102 -186
- package/os.d.ts +32 -6
- package/package.json +3 -8
- package/path/posix.d.ts +20 -0
- package/path/win32.d.ts +20 -0
- package/path.d.ts +132 -122
- package/perf_hooks.d.ts +310 -644
- package/process.d.ts +192 -138
- package/punycode.d.ts +17 -2
- package/querystring.d.ts +16 -1
- package/quic.d.ts +926 -0
- package/readline/promises.d.ts +16 -1
- package/readline.d.ts +80 -118
- package/repl.d.ts +98 -96
- package/sea.d.ts +25 -1
- package/sqlite.d.ts +277 -13
- package/stream/consumers.d.ts +22 -7
- package/stream/promises.d.ts +148 -12
- package/stream/web.d.ts +187 -494
- package/stream.d.ts +608 -490
- package/string_decoder.d.ts +18 -3
- package/test/reporters.d.ts +112 -0
- package/test.d.ts +238 -199
- package/timers/promises.d.ts +16 -1
- package/timers.d.ts +16 -129
- package/tls.d.ts +163 -163
- package/trace_events.d.ts +21 -6
- package/ts5.6/buffer.buffer.d.ts +25 -8
- package/ts5.6/compatibility/float16array.d.ts +15 -0
- package/ts5.6/globals.typedarray.d.ts +31 -0
- package/ts5.6/index.d.ts +39 -3
- package/ts5.7/compatibility/float16array.d.ts +15 -0
- package/ts5.7/index.d.ts +39 -3
- package/tty.d.ts +70 -13
- package/undici-types/agent.d.ts +20 -4
- package/undici-types/api.d.ts +15 -0
- package/undici-types/balanced-pool.d.ts +15 -0
- package/undici-types/cache-interceptor.d.ts +15 -0
- package/undici-types/cache.d.ts +15 -0
- package/undici-types/client-stats.d.ts +31 -0
- package/undici-types/client.d.ts +21 -5
- package/undici-types/connector.d.ts +15 -0
- package/undici-types/content-type.d.ts +15 -0
- package/undici-types/cookies.d.ts +15 -0
- package/undici-types/diagnostics-channel.d.ts +24 -1
- package/undici-types/dispatcher.d.ts +18 -8
- package/undici-types/env-http-proxy-agent.d.ts +17 -1
- package/undici-types/errors.d.ts +20 -15
- package/undici-types/eventsource.d.ts +24 -4
- package/undici-types/fetch.d.ts +16 -0
- package/undici-types/formdata.d.ts +15 -0
- package/undici-types/global-dispatcher.d.ts +15 -0
- package/undici-types/global-origin.d.ts +15 -0
- package/undici-types/h2c-client.d.ts +15 -2
- package/undici-types/handlers.d.ts +16 -1
- package/undici-types/header.d.ts +15 -0
- package/undici-types/index.d.ts +21 -1
- package/undici-types/interceptors.d.ts +20 -0
- package/undici-types/mock-agent.d.ts +18 -0
- package/undici-types/mock-call-history.d.ts +15 -0
- package/undici-types/mock-client.d.ts +17 -0
- package/undici-types/mock-errors.d.ts +15 -0
- package/undici-types/mock-interceptor.d.ts +17 -1
- package/undici-types/mock-pool.d.ts +17 -0
- package/undici-types/package.json +1 -1
- package/undici-types/patch.d.ts +15 -0
- package/undici-types/pool-stats.d.ts +15 -0
- package/undici-types/pool.d.ts +17 -0
- package/undici-types/proxy-agent.d.ts +16 -0
- package/undici-types/readable.d.ts +15 -0
- package/undici-types/retry-agent.d.ts +15 -0
- package/undici-types/retry-handler.d.ts +24 -0
- package/undici-types/snapshot-agent.d.ts +125 -0
- package/undici-types/util.d.ts +15 -0
- package/undici-types/utility.d.ts +15 -0
- package/undici-types/webidl.d.ts +126 -36
- package/undici-types/websocket.d.ts +18 -1
- package/url.d.ts +107 -587
- package/util/types.d.ts +571 -0
- package/util.d.ts +158 -792
- package/v8.d.ts +82 -7
- package/vm.d.ts +267 -108
- package/wasi.d.ts +38 -2
- package/web-globals/abortcontroller.d.ts +75 -0
- package/web-globals/blob.d.ts +39 -0
- package/web-globals/console.d.ts +25 -0
- package/web-globals/crypto.d.ts +55 -0
- package/web-globals/domexception.d.ts +84 -0
- package/web-globals/encoding.d.ts +27 -0
- package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
- package/web-globals/fetch.d.ts +70 -0
- package/web-globals/importmeta.d.ts +29 -0
- package/web-globals/messaging.d.ts +39 -0
- package/web-globals/navigator.d.ts +41 -0
- package/web-globals/performance.d.ts +61 -0
- package/web-globals/storage.d.ts +40 -0
- package/web-globals/streams.d.ts +131 -0
- package/web-globals/timers.d.ts +60 -0
- package/web-globals/url.d.ts +40 -0
- package/worker_threads.d.ts +306 -349
- package/zlib.d.ts +59 -94
- package/ts5.1/compatibility/disposable.d.ts +0 -13
- package/ts5.1/index.d.ts +0 -100
package/http.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// biome-ignore-all lint: generated file
|
|
2
|
+
// biome-ignore-all assist: generated file
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
* GENERATED FILE, DO NOT MODIFY
|
|
8
|
+
* 这是生成的文件,千万不要修改
|
|
9
|
+
*
|
|
10
|
+
* @build-script/codegen - The Simple Code Generater
|
|
11
|
+
* https://github.com/GongT/baobao
|
|
12
|
+
*
|
|
13
|
+
******************************************************************************/
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
/**
|
|
2
17
|
* To use the HTTP server and client one must import the `node:http` module.
|
|
3
18
|
*
|
|
@@ -37,15 +52,16 @@
|
|
|
37
52
|
* 'Host', 'example.com',
|
|
38
53
|
* 'accepT', '*' ]
|
|
39
54
|
* ```
|
|
40
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
55
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/http.js)
|
|
41
56
|
*/
|
|
42
57
|
|
|
43
58
|
declare module "node:http" {
|
|
44
|
-
import
|
|
45
|
-
import { URL } from 'node:url';
|
|
59
|
+
import { NonSharedBuffer } from 'node:buffer';
|
|
46
60
|
import { LookupOptions } from '_not-use-node-type_dns';
|
|
47
61
|
import { EventEmitter } from 'node:events';
|
|
48
|
-
import
|
|
62
|
+
import * as net from 'node:net';
|
|
63
|
+
import * as stream from 'node:stream';
|
|
64
|
+
import { URL } from 'node:url';
|
|
49
65
|
// incoming headers will never contain number
|
|
50
66
|
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
|
|
51
67
|
accept?: string | undefined;
|
|
@@ -201,7 +217,7 @@ declare module "node:http" {
|
|
|
201
217
|
"x-frame-options"?: string | undefined;
|
|
202
218
|
"x-xss-protection"?: string | undefined;
|
|
203
219
|
}
|
|
204
|
-
interface ClientRequestArgs {
|
|
220
|
+
interface ClientRequestArgs extends Pick<LookupOptions, "hints"> {
|
|
205
221
|
_defaultAgent?: Agent | undefined;
|
|
206
222
|
agent?: Agent | boolean | undefined;
|
|
207
223
|
auth?: string | null | undefined;
|
|
@@ -214,13 +230,12 @@ declare module "node:http" {
|
|
|
214
230
|
defaultPort?: number | string | undefined;
|
|
215
231
|
family?: number | undefined;
|
|
216
232
|
headers?: OutgoingHttpHeaders | readonly string[] | undefined;
|
|
217
|
-
hints?: LookupOptions["hints"];
|
|
218
233
|
host?: string | null | undefined;
|
|
219
234
|
hostname?: string | null | undefined;
|
|
220
235
|
insecureHTTPParser?: boolean | undefined;
|
|
221
236
|
localAddress?: string | undefined;
|
|
222
237
|
localPort?: number | undefined;
|
|
223
|
-
lookup?: LookupFunction | undefined;
|
|
238
|
+
lookup?: net.LookupFunction | undefined;
|
|
224
239
|
/**
|
|
225
240
|
* @default 16384
|
|
226
241
|
*/
|
|
@@ -235,7 +250,7 @@ declare module "node:http" {
|
|
|
235
250
|
socketPath?: string | undefined;
|
|
236
251
|
timeout?: number | undefined;
|
|
237
252
|
uniqueHeaders?: Array<string | string[]> | undefined;
|
|
238
|
-
joinDuplicateHeaders?: boolean;
|
|
253
|
+
joinDuplicateHeaders?: boolean | undefined;
|
|
239
254
|
}
|
|
240
255
|
interface ServerOptions<
|
|
241
256
|
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
|
@@ -261,7 +276,7 @@ declare module "node:http" {
|
|
|
261
276
|
* @default false
|
|
262
277
|
* @since v18.14.0
|
|
263
278
|
*/
|
|
264
|
-
joinDuplicateHeaders?: boolean;
|
|
279
|
+
joinDuplicateHeaders?: boolean | undefined;
|
|
265
280
|
/**
|
|
266
281
|
* The number of milliseconds of inactivity a server needs to wait for additional incoming data,
|
|
267
282
|
* after it has finished writing the last response, before a socket will be destroyed.
|
|
@@ -270,6 +285,13 @@ declare module "node:http" {
|
|
|
270
285
|
* @since v18.0.0
|
|
271
286
|
*/
|
|
272
287
|
keepAliveTimeout?: number | undefined;
|
|
288
|
+
/**
|
|
289
|
+
* An additional buffer time added to the
|
|
290
|
+
* `server.keepAliveTimeout` to extend the internal socket timeout.
|
|
291
|
+
* @since 24.6.0
|
|
292
|
+
* @default 1000
|
|
293
|
+
*/
|
|
294
|
+
keepAliveTimeoutBuffer?: number | undefined;
|
|
273
295
|
/**
|
|
274
296
|
* Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
|
|
275
297
|
* @default 30000
|
|
@@ -334,6 +356,17 @@ declare module "node:http" {
|
|
|
334
356
|
* If the header's value is an array, the items will be joined using `; `.
|
|
335
357
|
*/
|
|
336
358
|
uniqueHeaders?: Array<string | string[]> | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* A callback which receives an
|
|
361
|
+
* incoming request and returns a boolean, to control which upgrade attempts
|
|
362
|
+
* should be accepted. Accepted upgrades will fire an `'upgrade'` event (or
|
|
363
|
+
* their sockets will be destroyed, if no listener is registered) while
|
|
364
|
+
* rejected upgrades will fire a `'request'` event like any non-upgrade
|
|
365
|
+
* request.
|
|
366
|
+
* @since v24.9.0
|
|
367
|
+
* @default () => server.listenerCount('upgrade') > 0
|
|
368
|
+
*/
|
|
369
|
+
shouldUpgradeCallback?: ((request: InstanceType<Request>) => boolean) | undefined;
|
|
337
370
|
/**
|
|
338
371
|
* If set to `true`, an error is thrown when writing to an HTTP response which does not have a body.
|
|
339
372
|
* @default false
|
|
@@ -344,14 +377,27 @@ declare module "node:http" {
|
|
|
344
377
|
type RequestListener<
|
|
345
378
|
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
|
346
379
|
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
|
347
|
-
> = (
|
|
380
|
+
> = (request: InstanceType<Request>, response: InstanceType<Response> & { req: InstanceType<Request> }) => void;
|
|
381
|
+
interface ServerEventMap<
|
|
382
|
+
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
|
383
|
+
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
|
384
|
+
> extends net.ServerEventMap {
|
|
385
|
+
"checkContinue": Parameters<RequestListener<Request, Response>>;
|
|
386
|
+
"checkExpectation": Parameters<RequestListener<Request, Response>>;
|
|
387
|
+
"clientError": [exception: Error, socket: stream.Duplex];
|
|
388
|
+
"connect": [request: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer];
|
|
389
|
+
"connection": [socket: net.Socket];
|
|
390
|
+
"dropRequest": [request: InstanceType<Request>, socket: stream.Duplex];
|
|
391
|
+
"request": Parameters<RequestListener<Request, Response>>;
|
|
392
|
+
"upgrade": [req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer];
|
|
393
|
+
}
|
|
348
394
|
/**
|
|
349
395
|
* @since v0.1.17
|
|
350
396
|
*/
|
|
351
397
|
class Server<
|
|
352
398
|
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
|
353
399
|
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
|
354
|
-
> extends
|
|
400
|
+
> extends net.Server {
|
|
355
401
|
constructor(requestListener?: RequestListener<Request, Response>);
|
|
356
402
|
constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
|
|
357
403
|
/**
|
|
@@ -368,8 +414,8 @@ declare module "node:http" {
|
|
|
368
414
|
* @since v0.9.12
|
|
369
415
|
* @param [msecs=0 (no timeout)]
|
|
370
416
|
*/
|
|
371
|
-
setTimeout(msecs?: number, callback?: (socket: Socket) => void): this;
|
|
372
|
-
setTimeout(callback: (socket: Socket) => void): this;
|
|
417
|
+
setTimeout(msecs?: number, callback?: (socket: net.Socket) => void): this;
|
|
418
|
+
setTimeout(callback: (socket: net.Socket) => void): this;
|
|
373
419
|
/**
|
|
374
420
|
* Limits maximum incoming headers count. If set to 0, no limit will be applied.
|
|
375
421
|
* @since v0.7.0
|
|
@@ -414,12 +460,18 @@ declare module "node:http" {
|
|
|
414
460
|
/**
|
|
415
461
|
* The number of milliseconds of inactivity a server needs to wait for additional
|
|
416
462
|
* incoming data, after it has finished writing the last response, before a socket
|
|
417
|
-
* will be destroyed.
|
|
418
|
-
*
|
|
463
|
+
* will be destroyed.
|
|
464
|
+
*
|
|
465
|
+
* This timeout value is combined with the
|
|
466
|
+
* `server.keepAliveTimeoutBuffer` option to determine the actual socket
|
|
467
|
+
* timeout, calculated as:
|
|
468
|
+
* socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer
|
|
469
|
+
* If the server receives new data before the keep-alive timeout has fired, it
|
|
470
|
+
* will reset the regular inactivity timeout, i.e., `server.timeout`.
|
|
419
471
|
*
|
|
420
472
|
* A value of `0` will disable the keep-alive timeout behavior on incoming
|
|
421
473
|
* connections.
|
|
422
|
-
* A value of `0` makes the
|
|
474
|
+
* A value of `0` makes the HTTP server behave similarly to Node.js versions prior
|
|
423
475
|
* to 8.0.0, which did not have a keep-alive timeout.
|
|
424
476
|
*
|
|
425
477
|
* The socket timeout logic is set up on connection, so changing this value only
|
|
@@ -427,6 +479,18 @@ declare module "node:http" {
|
|
|
427
479
|
* @since v8.0.0
|
|
428
480
|
*/
|
|
429
481
|
keepAliveTimeout: number;
|
|
482
|
+
/**
|
|
483
|
+
* An additional buffer time added to the
|
|
484
|
+
* `server.keepAliveTimeout` to extend the internal socket timeout.
|
|
485
|
+
*
|
|
486
|
+
* This buffer helps reduce connection reset (`ECONNRESET`) errors by increasing
|
|
487
|
+
* the socket timeout slightly beyond the advertised keep-alive timeout.
|
|
488
|
+
*
|
|
489
|
+
* This option applies only to new incoming connections.
|
|
490
|
+
* @since v24.6.0
|
|
491
|
+
* @default 1000
|
|
492
|
+
*/
|
|
493
|
+
keepAliveTimeoutBuffer: number;
|
|
430
494
|
/**
|
|
431
495
|
* Sets the timeout value in milliseconds for receiving the entire request from
|
|
432
496
|
* the client.
|
|
@@ -451,120 +515,64 @@ declare module "node:http" {
|
|
|
451
515
|
* @since v18.2.0
|
|
452
516
|
*/
|
|
453
517
|
closeIdleConnections(): void;
|
|
454
|
-
|
|
455
|
-
addListener
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
addListener(event: "listening", listener: () => void): this;
|
|
459
|
-
addListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
|
|
460
|
-
addListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
|
|
461
|
-
addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
462
|
-
addListener(
|
|
463
|
-
event: "connect",
|
|
464
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
465
|
-
): this;
|
|
466
|
-
addListener(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
|
467
|
-
addListener(event: "request", listener: RequestListener<Request, Response>): this;
|
|
468
|
-
addListener(
|
|
469
|
-
event: "upgrade",
|
|
470
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
471
|
-
): this;
|
|
472
|
-
emit(event: string, ...args: any[]): boolean;
|
|
473
|
-
emit(event: "close"): boolean;
|
|
474
|
-
emit(event: "connection", socket: Socket): boolean;
|
|
475
|
-
emit(event: "error", err: Error): boolean;
|
|
476
|
-
emit(event: "listening"): boolean;
|
|
477
|
-
emit(
|
|
478
|
-
event: "checkContinue",
|
|
479
|
-
req: InstanceType<Request>,
|
|
480
|
-
res: InstanceType<Response> & { req: InstanceType<Request> },
|
|
481
|
-
): boolean;
|
|
482
|
-
emit(
|
|
483
|
-
event: "checkExpectation",
|
|
484
|
-
req: InstanceType<Request>,
|
|
485
|
-
res: InstanceType<Response> & { req: InstanceType<Request> },
|
|
486
|
-
): boolean;
|
|
487
|
-
emit(event: "clientError", err: Error, socket: stream.Duplex): boolean;
|
|
488
|
-
emit(event: "connect", req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean;
|
|
489
|
-
emit(event: "dropRequest", req: InstanceType<Request>, socket: stream.Duplex): boolean;
|
|
490
|
-
emit(
|
|
491
|
-
event: "request",
|
|
492
|
-
req: InstanceType<Request>,
|
|
493
|
-
res: InstanceType<Response> & { req: InstanceType<Request> },
|
|
494
|
-
): boolean;
|
|
495
|
-
emit(event: "upgrade", req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean;
|
|
496
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
497
|
-
on(event: "close", listener: () => void): this;
|
|
498
|
-
on(event: "connection", listener: (socket: Socket) => void): this;
|
|
499
|
-
on(event: "error", listener: (err: Error) => void): this;
|
|
500
|
-
on(event: "listening", listener: () => void): this;
|
|
501
|
-
on(event: "checkContinue", listener: RequestListener<Request, Response>): this;
|
|
502
|
-
on(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
|
|
503
|
-
on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
504
|
-
on(event: "connect", listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
505
|
-
on(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
|
506
|
-
on(event: "request", listener: RequestListener<Request, Response>): this;
|
|
507
|
-
on(event: "upgrade", listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
|
|
508
|
-
once(event: string, listener: (...args: any[]) => void): this;
|
|
509
|
-
once(event: "close", listener: () => void): this;
|
|
510
|
-
once(event: "connection", listener: (socket: Socket) => void): this;
|
|
511
|
-
once(event: "error", listener: (err: Error) => void): this;
|
|
512
|
-
once(event: "listening", listener: () => void): this;
|
|
513
|
-
once(event: "checkContinue", listener: RequestListener<Request, Response>): this;
|
|
514
|
-
once(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
|
|
515
|
-
once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
516
|
-
once(
|
|
517
|
-
event: "connect",
|
|
518
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
519
|
-
): this;
|
|
520
|
-
once(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
|
521
|
-
once(event: "request", listener: RequestListener<Request, Response>): this;
|
|
522
|
-
once(
|
|
523
|
-
event: "upgrade",
|
|
524
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
518
|
+
// #region InternalEventEmitter
|
|
519
|
+
addListener<E extends keyof ServerEventMap>(
|
|
520
|
+
eventName: E,
|
|
521
|
+
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
|
525
522
|
): this;
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
523
|
+
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
524
|
+
emit<E extends keyof ServerEventMap>(eventName: E, ...args: ServerEventMap<Request, Response>[E]): boolean;
|
|
525
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
526
|
+
listenerCount<E extends keyof ServerEventMap>(
|
|
527
|
+
eventName: E,
|
|
528
|
+
listener?: (...args: ServerEventMap<Request, Response>[E]) => void,
|
|
529
|
+
): number;
|
|
530
|
+
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
|
531
|
+
listeners<E extends keyof ServerEventMap>(
|
|
532
|
+
eventName: E,
|
|
533
|
+
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
|
|
534
|
+
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
535
|
+
off<E extends keyof ServerEventMap>(
|
|
536
|
+
eventName: E,
|
|
537
|
+
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
|
537
538
|
): this;
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
539
|
+
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
540
|
+
on<E extends keyof ServerEventMap>(
|
|
541
|
+
eventName: E,
|
|
542
|
+
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
|
541
543
|
): this;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
listener: (
|
|
544
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
545
|
+
once<E extends keyof ServerEventMap>(
|
|
546
|
+
eventName: E,
|
|
547
|
+
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
|
546
548
|
): this;
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
prependOnceListener(event: "listening", listener: () => void): this;
|
|
552
|
-
prependOnceListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
|
|
553
|
-
prependOnceListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
|
|
554
|
-
prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
555
|
-
prependOnceListener(
|
|
556
|
-
event: "connect",
|
|
557
|
-
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
|
|
549
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
550
|
+
prependListener<E extends keyof ServerEventMap>(
|
|
551
|
+
eventName: E,
|
|
552
|
+
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
|
558
553
|
): this;
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
554
|
+
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
555
|
+
prependOnceListener<E extends keyof ServerEventMap>(
|
|
556
|
+
eventName: E,
|
|
557
|
+
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
|
562
558
|
): this;
|
|
563
|
-
prependOnceListener(
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
559
|
+
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
560
|
+
rawListeners<E extends keyof ServerEventMap>(
|
|
561
|
+
eventName: E,
|
|
562
|
+
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
|
|
563
|
+
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
564
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
565
|
+
removeAllListeners<E extends keyof ServerEventMap>(eventName?: E): this;
|
|
566
|
+
removeAllListeners(eventName?: string | symbol): this;
|
|
567
|
+
removeListener<E extends keyof ServerEventMap>(
|
|
568
|
+
eventName: E,
|
|
569
|
+
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
|
567
570
|
): this;
|
|
571
|
+
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
572
|
+
// #endregion
|
|
573
|
+
}
|
|
574
|
+
interface OutgoingMessageEventMap extends stream.WritableEventMap {
|
|
575
|
+
"prefinish": [];
|
|
568
576
|
}
|
|
569
577
|
/**
|
|
570
578
|
* This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from
|
|
@@ -572,6 +580,7 @@ declare module "node:http" {
|
|
|
572
580
|
* @since v0.1.17
|
|
573
581
|
*/
|
|
574
582
|
class OutgoingMessage<Request extends IncomingMessage = IncomingMessage> extends stream.Writable {
|
|
583
|
+
constructor();
|
|
575
584
|
readonly req: Request;
|
|
576
585
|
chunkedEncoding: boolean;
|
|
577
586
|
shouldKeepAlive: boolean;
|
|
@@ -591,7 +600,7 @@ declare module "node:http" {
|
|
|
591
600
|
* @since v0.3.0
|
|
592
601
|
* @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead.
|
|
593
602
|
*/
|
|
594
|
-
readonly connection: Socket | null;
|
|
603
|
+
readonly connection: net.Socket | null;
|
|
595
604
|
/**
|
|
596
605
|
* Reference to the underlying socket. Usually, users will not want to access
|
|
597
606
|
* this property.
|
|
@@ -599,8 +608,7 @@ declare module "node:http" {
|
|
|
599
608
|
* After calling `outgoingMessage.end()`, this property will be nulled.
|
|
600
609
|
* @since v0.3.0
|
|
601
610
|
*/
|
|
602
|
-
readonly socket: Socket | null;
|
|
603
|
-
constructor();
|
|
611
|
+
readonly socket: net.Socket | null;
|
|
604
612
|
/**
|
|
605
613
|
* Once a socket is associated with the message and is connected, `socket.setTimeout()` will be called with `msecs` as the first parameter.
|
|
606
614
|
* @since v0.9.12
|
|
@@ -758,6 +766,61 @@ declare module "node:http" {
|
|
|
758
766
|
* @since v1.6.0
|
|
759
767
|
*/
|
|
760
768
|
flushHeaders(): void;
|
|
769
|
+
// #region InternalEventEmitter
|
|
770
|
+
addListener<E extends keyof OutgoingMessageEventMap>(
|
|
771
|
+
eventName: E,
|
|
772
|
+
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
|
773
|
+
): this;
|
|
774
|
+
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
775
|
+
emit<E extends keyof OutgoingMessageEventMap>(eventName: E, ...args: OutgoingMessageEventMap[E]): boolean;
|
|
776
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
777
|
+
listenerCount<E extends keyof OutgoingMessageEventMap>(
|
|
778
|
+
eventName: E,
|
|
779
|
+
listener?: (...args: OutgoingMessageEventMap[E]) => void,
|
|
780
|
+
): number;
|
|
781
|
+
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
|
782
|
+
listeners<E extends keyof OutgoingMessageEventMap>(
|
|
783
|
+
eventName: E,
|
|
784
|
+
): ((...args: OutgoingMessageEventMap[E]) => void)[];
|
|
785
|
+
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
786
|
+
off<E extends keyof OutgoingMessageEventMap>(
|
|
787
|
+
eventName: E,
|
|
788
|
+
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
|
789
|
+
): this;
|
|
790
|
+
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
791
|
+
on<E extends keyof OutgoingMessageEventMap>(
|
|
792
|
+
eventName: E,
|
|
793
|
+
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
|
794
|
+
): this;
|
|
795
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
796
|
+
once<E extends keyof OutgoingMessageEventMap>(
|
|
797
|
+
eventName: E,
|
|
798
|
+
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
|
799
|
+
): this;
|
|
800
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
801
|
+
prependListener<E extends keyof OutgoingMessageEventMap>(
|
|
802
|
+
eventName: E,
|
|
803
|
+
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
|
804
|
+
): this;
|
|
805
|
+
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
806
|
+
prependOnceListener<E extends keyof OutgoingMessageEventMap>(
|
|
807
|
+
eventName: E,
|
|
808
|
+
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
|
809
|
+
): this;
|
|
810
|
+
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
811
|
+
rawListeners<E extends keyof OutgoingMessageEventMap>(
|
|
812
|
+
eventName: E,
|
|
813
|
+
): ((...args: OutgoingMessageEventMap[E]) => void)[];
|
|
814
|
+
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
815
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
816
|
+
removeAllListeners<E extends keyof OutgoingMessageEventMap>(eventName?: E): this;
|
|
817
|
+
removeAllListeners(eventName?: string | symbol): this;
|
|
818
|
+
removeListener<E extends keyof OutgoingMessageEventMap>(
|
|
819
|
+
eventName: E,
|
|
820
|
+
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
|
821
|
+
): this;
|
|
822
|
+
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
823
|
+
// #endregion
|
|
761
824
|
}
|
|
762
825
|
/**
|
|
763
826
|
* This object is created internally by an HTTP server, not by the user. It is
|
|
@@ -802,8 +865,8 @@ declare module "node:http" {
|
|
|
802
865
|
*/
|
|
803
866
|
strictContentLength: boolean;
|
|
804
867
|
constructor(req: Request);
|
|
805
|
-
assignSocket(socket: Socket): void;
|
|
806
|
-
detachSocket(socket: Socket): void;
|
|
868
|
+
assignSocket(socket: net.Socket): void;
|
|
869
|
+
detachSocket(socket: net.Socket): void;
|
|
807
870
|
/**
|
|
808
871
|
* Sends an HTTP/1.1 100 Continue message to the client, indicating that
|
|
809
872
|
* the request body should be sent. See the `'checkContinue'` event on `Server`.
|
|
@@ -912,17 +975,28 @@ declare module "node:http" {
|
|
|
912
975
|
* the request body should be sent.
|
|
913
976
|
* @since v10.0.0
|
|
914
977
|
*/
|
|
915
|
-
writeProcessing(): void;
|
|
978
|
+
writeProcessing(callback?: () => void): void;
|
|
916
979
|
}
|
|
917
980
|
interface InformationEvent {
|
|
918
|
-
statusCode: number;
|
|
919
|
-
statusMessage: string;
|
|
920
981
|
httpVersion: string;
|
|
921
982
|
httpVersionMajor: number;
|
|
922
983
|
httpVersionMinor: number;
|
|
984
|
+
statusCode: number;
|
|
985
|
+
statusMessage: string;
|
|
923
986
|
headers: IncomingHttpHeaders;
|
|
924
987
|
rawHeaders: string[];
|
|
925
988
|
}
|
|
989
|
+
interface ClientRequestEventMap extends stream.WritableEventMap {
|
|
990
|
+
/** @deprecated Listen for the `'close'` event instead. */
|
|
991
|
+
"abort": [];
|
|
992
|
+
"connect": [response: IncomingMessage, socket: net.Socket, head: NonSharedBuffer];
|
|
993
|
+
"continue": [];
|
|
994
|
+
"information": [info: InformationEvent];
|
|
995
|
+
"response": [response: IncomingMessage];
|
|
996
|
+
"socket": [socket: net.Socket];
|
|
997
|
+
"timeout": [];
|
|
998
|
+
"upgrade": [response: IncomingMessage, socket: net.Socket, head: NonSharedBuffer];
|
|
999
|
+
}
|
|
926
1000
|
/**
|
|
927
1001
|
* This object is created internally and returned from {@link request}. It
|
|
928
1002
|
* represents an _in-progress_ request whose header has already been queued. The
|
|
@@ -1045,7 +1119,7 @@ declare module "node:http" {
|
|
|
1045
1119
|
* @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead.
|
|
1046
1120
|
*/
|
|
1047
1121
|
abort(): void;
|
|
1048
|
-
onSocket(socket: Socket): void;
|
|
1122
|
+
onSocket(socket: net.Socket): void;
|
|
1049
1123
|
/**
|
|
1050
1124
|
* Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called.
|
|
1051
1125
|
* @since v0.5.9
|
|
@@ -1077,114 +1151,63 @@ declare module "node:http" {
|
|
|
1077
1151
|
* @since v15.13.0, v14.17.0
|
|
1078
1152
|
*/
|
|
1079
1153
|
getRawHeaderNames(): string[];
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1154
|
+
// #region InternalEventEmitter
|
|
1155
|
+
addListener<E extends keyof ClientRequestEventMap>(
|
|
1156
|
+
eventName: E,
|
|
1157
|
+
listener: (...args: ClientRequestEventMap[E]) => void,
|
|
1158
|
+
): this;
|
|
1159
|
+
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1160
|
+
emit<E extends keyof ClientRequestEventMap>(eventName: E, ...args: ClientRequestEventMap[E]): boolean;
|
|
1161
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
1162
|
+
listenerCount<E extends keyof ClientRequestEventMap>(
|
|
1163
|
+
eventName: E,
|
|
1164
|
+
listener?: (...args: ClientRequestEventMap[E]) => void,
|
|
1165
|
+
): number;
|
|
1166
|
+
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
|
1167
|
+
listeners<E extends keyof ClientRequestEventMap>(eventName: E): ((...args: ClientRequestEventMap[E]) => void)[];
|
|
1168
|
+
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
1169
|
+
off<E extends keyof ClientRequestEventMap>(
|
|
1170
|
+
eventName: E,
|
|
1171
|
+
listener: (...args: ClientRequestEventMap[E]) => void,
|
|
1087
1172
|
): this;
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
addListener(event: "timeout", listener: () => void): this;
|
|
1093
|
-
addListener(
|
|
1094
|
-
event: "upgrade",
|
|
1095
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
1173
|
+
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1174
|
+
on<E extends keyof ClientRequestEventMap>(
|
|
1175
|
+
eventName: E,
|
|
1176
|
+
listener: (...args: ClientRequestEventMap[E]) => void,
|
|
1096
1177
|
): this;
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
1102
|
-
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
1103
|
-
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1104
|
-
/**
|
|
1105
|
-
* @deprecated
|
|
1106
|
-
*/
|
|
1107
|
-
on(event: "abort", listener: () => void): this;
|
|
1108
|
-
on(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
1109
|
-
on(event: "continue", listener: () => void): this;
|
|
1110
|
-
on(event: "information", listener: (info: InformationEvent) => void): this;
|
|
1111
|
-
on(event: "response", listener: (response: IncomingMessage) => void): this;
|
|
1112
|
-
on(event: "socket", listener: (socket: Socket) => void): this;
|
|
1113
|
-
on(event: "timeout", listener: () => void): this;
|
|
1114
|
-
on(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
1115
|
-
on(event: "close", listener: () => void): this;
|
|
1116
|
-
on(event: "drain", listener: () => void): this;
|
|
1117
|
-
on(event: "error", listener: (err: Error) => void): this;
|
|
1118
|
-
on(event: "finish", listener: () => void): this;
|
|
1119
|
-
on(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
1120
|
-
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
1121
|
-
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1122
|
-
/**
|
|
1123
|
-
* @deprecated
|
|
1124
|
-
*/
|
|
1125
|
-
once(event: "abort", listener: () => void): this;
|
|
1126
|
-
once(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
1127
|
-
once(event: "continue", listener: () => void): this;
|
|
1128
|
-
once(event: "information", listener: (info: InformationEvent) => void): this;
|
|
1129
|
-
once(event: "response", listener: (response: IncomingMessage) => void): this;
|
|
1130
|
-
once(event: "socket", listener: (socket: Socket) => void): this;
|
|
1131
|
-
once(event: "timeout", listener: () => void): this;
|
|
1132
|
-
once(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
1133
|
-
once(event: "close", listener: () => void): this;
|
|
1134
|
-
once(event: "drain", listener: () => void): this;
|
|
1135
|
-
once(event: "error", listener: (err: Error) => void): this;
|
|
1136
|
-
once(event: "finish", listener: () => void): this;
|
|
1137
|
-
once(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
1138
|
-
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
1139
|
-
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1140
|
-
/**
|
|
1141
|
-
* @deprecated
|
|
1142
|
-
*/
|
|
1143
|
-
prependListener(event: "abort", listener: () => void): this;
|
|
1144
|
-
prependListener(
|
|
1145
|
-
event: "connect",
|
|
1146
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
1178
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1179
|
+
once<E extends keyof ClientRequestEventMap>(
|
|
1180
|
+
eventName: E,
|
|
1181
|
+
listener: (...args: ClientRequestEventMap[E]) => void,
|
|
1147
1182
|
): this;
|
|
1148
|
-
|
|
1149
|
-
prependListener
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
prependListener(event: "timeout", listener: () => void): this;
|
|
1153
|
-
prependListener(
|
|
1154
|
-
event: "upgrade",
|
|
1155
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
1183
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1184
|
+
prependListener<E extends keyof ClientRequestEventMap>(
|
|
1185
|
+
eventName: E,
|
|
1186
|
+
listener: (...args: ClientRequestEventMap[E]) => void,
|
|
1156
1187
|
): this;
|
|
1157
|
-
prependListener(
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
1162
|
-
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
1163
|
-
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1164
|
-
/**
|
|
1165
|
-
* @deprecated
|
|
1166
|
-
*/
|
|
1167
|
-
prependOnceListener(event: "abort", listener: () => void): this;
|
|
1168
|
-
prependOnceListener(
|
|
1169
|
-
event: "connect",
|
|
1170
|
-
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
|
|
1188
|
+
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1189
|
+
prependOnceListener<E extends keyof ClientRequestEventMap>(
|
|
1190
|
+
eventName: E,
|
|
1191
|
+
listener: (...args: ClientRequestEventMap[E]) => void,
|
|
1171
1192
|
): this;
|
|
1172
|
-
prependOnceListener(
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1193
|
+
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1194
|
+
rawListeners<E extends keyof ClientRequestEventMap>(
|
|
1195
|
+
eventName: E,
|
|
1196
|
+
): ((...args: ClientRequestEventMap[E]) => void)[];
|
|
1197
|
+
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
1198
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
1199
|
+
removeAllListeners<E extends keyof ClientRequestEventMap>(eventName?: E): this;
|
|
1200
|
+
removeAllListeners(eventName?: string | symbol): this;
|
|
1201
|
+
removeListener<E extends keyof ClientRequestEventMap>(
|
|
1202
|
+
eventName: E,
|
|
1203
|
+
listener: (...args: ClientRequestEventMap[E]) => void,
|
|
1180
1204
|
): this;
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1205
|
+
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1206
|
+
// #endregion
|
|
1207
|
+
}
|
|
1208
|
+
interface IncomingMessageEventMap extends stream.ReadableEventMap {
|
|
1209
|
+
/** @deprecated Listen for `'close'` event instead. */
|
|
1210
|
+
"aborted": [];
|
|
1188
1211
|
}
|
|
1189
1212
|
/**
|
|
1190
1213
|
* 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
|
|
@@ -1197,7 +1220,7 @@ declare module "node:http" {
|
|
|
1197
1220
|
* @since v0.1.17
|
|
1198
1221
|
*/
|
|
1199
1222
|
class IncomingMessage extends stream.Readable {
|
|
1200
|
-
constructor(socket: Socket);
|
|
1223
|
+
constructor(socket: net.Socket);
|
|
1201
1224
|
/**
|
|
1202
1225
|
* The `message.aborted` property will be `true` if the request has
|
|
1203
1226
|
* been aborted.
|
|
@@ -1245,7 +1268,7 @@ declare module "node:http" {
|
|
|
1245
1268
|
* @since v0.1.90
|
|
1246
1269
|
* @deprecated Since v16.0.0 - Use `socket`.
|
|
1247
1270
|
*/
|
|
1248
|
-
connection: Socket;
|
|
1271
|
+
connection: net.Socket;
|
|
1249
1272
|
/**
|
|
1250
1273
|
* The `net.Socket` object associated with the connection.
|
|
1251
1274
|
*
|
|
@@ -1257,7 +1280,7 @@ declare module "node:http" {
|
|
|
1257
1280
|
* type other than `net.Socket` or internally nulled.
|
|
1258
1281
|
* @since v0.3.0
|
|
1259
1282
|
*/
|
|
1260
|
-
socket: Socket;
|
|
1283
|
+
socket: net.Socket;
|
|
1261
1284
|
/**
|
|
1262
1285
|
* The request/response headers object.
|
|
1263
1286
|
*
|
|
@@ -1419,8 +1442,71 @@ declare module "node:http" {
|
|
|
1419
1442
|
* @since v0.3.0
|
|
1420
1443
|
*/
|
|
1421
1444
|
destroy(error?: Error): this;
|
|
1445
|
+
// #region InternalEventEmitter
|
|
1446
|
+
addListener<E extends keyof IncomingMessageEventMap>(
|
|
1447
|
+
eventName: E,
|
|
1448
|
+
listener: (...args: IncomingMessageEventMap[E]) => void,
|
|
1449
|
+
): this;
|
|
1450
|
+
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1451
|
+
emit<E extends keyof IncomingMessageEventMap>(eventName: E, ...args: IncomingMessageEventMap[E]): boolean;
|
|
1452
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
1453
|
+
listenerCount<E extends keyof IncomingMessageEventMap>(
|
|
1454
|
+
eventName: E,
|
|
1455
|
+
listener?: (...args: IncomingMessageEventMap[E]) => void,
|
|
1456
|
+
): number;
|
|
1457
|
+
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
|
1458
|
+
listeners<E extends keyof IncomingMessageEventMap>(
|
|
1459
|
+
eventName: E,
|
|
1460
|
+
): ((...args: IncomingMessageEventMap[E]) => void)[];
|
|
1461
|
+
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
1462
|
+
off<E extends keyof IncomingMessageEventMap>(
|
|
1463
|
+
eventName: E,
|
|
1464
|
+
listener: (...args: IncomingMessageEventMap[E]) => void,
|
|
1465
|
+
): this;
|
|
1466
|
+
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1467
|
+
on<E extends keyof IncomingMessageEventMap>(
|
|
1468
|
+
eventName: E,
|
|
1469
|
+
listener: (...args: IncomingMessageEventMap[E]) => void,
|
|
1470
|
+
): this;
|
|
1471
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1472
|
+
once<E extends keyof IncomingMessageEventMap>(
|
|
1473
|
+
eventName: E,
|
|
1474
|
+
listener: (...args: IncomingMessageEventMap[E]) => void,
|
|
1475
|
+
): this;
|
|
1476
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1477
|
+
prependListener<E extends keyof IncomingMessageEventMap>(
|
|
1478
|
+
eventName: E,
|
|
1479
|
+
listener: (...args: IncomingMessageEventMap[E]) => void,
|
|
1480
|
+
): this;
|
|
1481
|
+
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1482
|
+
prependOnceListener<E extends keyof IncomingMessageEventMap>(
|
|
1483
|
+
eventName: E,
|
|
1484
|
+
listener: (...args: IncomingMessageEventMap[E]) => void,
|
|
1485
|
+
): this;
|
|
1486
|
+
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1487
|
+
rawListeners<E extends keyof IncomingMessageEventMap>(
|
|
1488
|
+
eventName: E,
|
|
1489
|
+
): ((...args: IncomingMessageEventMap[E]) => void)[];
|
|
1490
|
+
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
1491
|
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
1492
|
+
removeAllListeners<E extends keyof IncomingMessageEventMap>(eventName?: E): this;
|
|
1493
|
+
removeAllListeners(eventName?: string | symbol): this;
|
|
1494
|
+
removeListener<E extends keyof IncomingMessageEventMap>(
|
|
1495
|
+
eventName: E,
|
|
1496
|
+
listener: (...args: IncomingMessageEventMap[E]) => void,
|
|
1497
|
+
): this;
|
|
1498
|
+
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
1499
|
+
// #endregion
|
|
1500
|
+
}
|
|
1501
|
+
interface ProxyEnv extends NodeJS.ProcessEnv {
|
|
1502
|
+
HTTP_PROXY?: string | undefined;
|
|
1503
|
+
HTTPS_PROXY?: string | undefined;
|
|
1504
|
+
NO_PROXY?: string | undefined;
|
|
1505
|
+
http_proxy?: string | undefined;
|
|
1506
|
+
https_proxy?: string | undefined;
|
|
1507
|
+
no_proxy?: string | undefined;
|
|
1422
1508
|
}
|
|
1423
|
-
interface AgentOptions extends
|
|
1509
|
+
interface AgentOptions extends NodeJS.PartialOptions<net.TcpSocketConnectOpts> {
|
|
1424
1510
|
/**
|
|
1425
1511
|
* Keep sockets around in a pool to be used by other requests in the future. Default = false
|
|
1426
1512
|
*/
|
|
@@ -1430,6 +1516,16 @@ declare module "node:http" {
|
|
|
1430
1516
|
* Only relevant if keepAlive is set to true.
|
|
1431
1517
|
*/
|
|
1432
1518
|
keepAliveMsecs?: number | undefined;
|
|
1519
|
+
/**
|
|
1520
|
+
* Milliseconds to subtract from
|
|
1521
|
+
* the server-provided `keep-alive: timeout=...` hint when determining socket
|
|
1522
|
+
* expiration time. This buffer helps ensure the agent closes the socket
|
|
1523
|
+
* slightly before the server does, reducing the chance of sending a request
|
|
1524
|
+
* on a socket that’s about to be closed by the server.
|
|
1525
|
+
* @since v24.7.0
|
|
1526
|
+
* @default 1000
|
|
1527
|
+
*/
|
|
1528
|
+
agentKeepAliveTimeoutBuffer?: number | undefined;
|
|
1433
1529
|
/**
|
|
1434
1530
|
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
|
1435
1531
|
*/
|
|
@@ -1451,6 +1547,22 @@ declare module "node:http" {
|
|
|
1451
1547
|
* @default `lifo`
|
|
1452
1548
|
*/
|
|
1453
1549
|
scheduling?: "fifo" | "lifo" | undefined;
|
|
1550
|
+
/**
|
|
1551
|
+
* Environment variables for proxy configuration. See
|
|
1552
|
+
* [Built-in Proxy Support](https://nodejs.org/docs/latest-v25.x/api/http.html#built-in-proxy-support) for details.
|
|
1553
|
+
* @since v24.5.0
|
|
1554
|
+
*/
|
|
1555
|
+
proxyEnv?: ProxyEnv | undefined;
|
|
1556
|
+
/**
|
|
1557
|
+
* Default port to use when the port is not specified in requests.
|
|
1558
|
+
* @since v24.5.0
|
|
1559
|
+
*/
|
|
1560
|
+
defaultPort?: number | undefined;
|
|
1561
|
+
/**
|
|
1562
|
+
* The protocol to use for the agent.
|
|
1563
|
+
* @since v24.5.0
|
|
1564
|
+
*/
|
|
1565
|
+
protocol?: string | undefined;
|
|
1454
1566
|
}
|
|
1455
1567
|
/**
|
|
1456
1568
|
* An `Agent` is responsible for managing connection persistence
|
|
@@ -1506,7 +1618,7 @@ declare module "node:http" {
|
|
|
1506
1618
|
* });
|
|
1507
1619
|
* ```
|
|
1508
1620
|
*
|
|
1509
|
-
* `options` in [`socket.connect()`](https://nodejs.org/docs/latest-
|
|
1621
|
+
* `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v25.x/api/net.html#socketconnectoptions-connectlistener) are also supported.
|
|
1510
1622
|
*
|
|
1511
1623
|
* To configure any of them, a custom {@link Agent} instance must be created.
|
|
1512
1624
|
*
|
|
@@ -1546,13 +1658,13 @@ declare module "node:http" {
|
|
|
1546
1658
|
* removed from the array on `'timeout'`.
|
|
1547
1659
|
* @since v0.11.4
|
|
1548
1660
|
*/
|
|
1549
|
-
readonly freeSockets: NodeJS.ReadOnlyDict<Socket[]>;
|
|
1661
|
+
readonly freeSockets: NodeJS.ReadOnlyDict<net.Socket[]>;
|
|
1550
1662
|
/**
|
|
1551
1663
|
* An object which contains arrays of sockets currently in use by the
|
|
1552
1664
|
* agent. Do not modify.
|
|
1553
1665
|
* @since v0.3.6
|
|
1554
1666
|
*/
|
|
1555
|
-
readonly sockets: NodeJS.ReadOnlyDict<Socket[]>;
|
|
1667
|
+
readonly sockets: NodeJS.ReadOnlyDict<net.Socket[]>;
|
|
1556
1668
|
/**
|
|
1557
1669
|
* An object which contains queues of requests that have not yet been assigned to
|
|
1558
1670
|
* sockets. Do not modify.
|
|
@@ -1592,7 +1704,7 @@ declare module "node:http" {
|
|
|
1592
1704
|
createConnection(
|
|
1593
1705
|
options: ClientRequestArgs,
|
|
1594
1706
|
callback?: (err: Error | null, stream: stream.Duplex) => void,
|
|
1595
|
-
): stream.Duplex;
|
|
1707
|
+
): stream.Duplex | null | undefined;
|
|
1596
1708
|
/**
|
|
1597
1709
|
* Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to:
|
|
1598
1710
|
*
|
|
@@ -2029,16 +2141,16 @@ declare module "node:http" {
|
|
|
2029
2141
|
*/
|
|
2030
2142
|
const maxHeaderSize: number;
|
|
2031
2143
|
/**
|
|
2032
|
-
* A browser-compatible implementation of
|
|
2144
|
+
* A browser-compatible implementation of `WebSocket`.
|
|
2033
2145
|
* @since v22.5.0
|
|
2034
2146
|
*/
|
|
2035
|
-
const WebSocket: import('./undici-types').WebSocket;
|
|
2147
|
+
const WebSocket: typeof import('./undici-types').WebSocket;
|
|
2036
2148
|
/**
|
|
2037
2149
|
* @since v22.5.0
|
|
2038
2150
|
*/
|
|
2039
|
-
const CloseEvent: import('./undici-types').CloseEvent;
|
|
2151
|
+
const CloseEvent: typeof import('./undici-types').CloseEvent;
|
|
2040
2152
|
/**
|
|
2041
2153
|
* @since v22.5.0
|
|
2042
2154
|
*/
|
|
2043
|
-
const MessageEvent: import('./undici-types').MessageEvent;
|
|
2155
|
+
const MessageEvent: typeof import('./undici-types').MessageEvent;
|
|
2044
2156
|
}
|