source: node_modules/undici/types/client.d.ts

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 16 months ago

Initial commit

  • Property mode set to 100644
File size: 4.5 KB
Line 
1import { URL } from 'url'
2import { TlsOptions } from 'tls'
3import Dispatcher from './dispatcher'
4import buildConnector from "./connector";
5
6/**
7 * A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
8 */
9export class Client extends Dispatcher {
10 constructor(url: string | URL, options?: Client.Options);
11 /** Property to get and set the pipelining factor. */
12 pipelining: number;
13 /** `true` after `client.close()` has been called. */
14 closed: boolean;
15 /** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
16 destroyed: boolean;
17}
18
19export declare namespace Client {
20 export interface OptionsInterceptors {
21 Client: readonly Dispatcher.DispatchInterceptor[];
22 }
23 export interface Options {
24 /** TODO */
25 interceptors?: OptionsInterceptors;
26 /** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
27 maxHeaderSize?: number;
28 /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
29 headersTimeout?: number;
30 /** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */
31 socketTimeout?: never;
32 /** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */
33 requestTimeout?: never;
34 /** TODO */
35 connectTimeout?: number;
36 /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
37 bodyTimeout?: number;
38 /** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */
39 idleTimeout?: never;
40 /** @deprecated unsupported keepAlive, use pipelining=0 instead */
41 keepAlive?: never;
42 /** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
43 keepAliveTimeout?: number;
44 /** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */
45 maxKeepAliveTimeout?: never;
46 /** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
47 keepAliveMaxTimeout?: number;
48 /** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
49 keepAliveTimeoutThreshold?: number;
50 /** TODO */
51 socketPath?: string;
52 /** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
53 pipelining?: number;
54 /** @deprecated use the connect option instead */
55 tls?: never;
56 /** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
57 strictContentLength?: boolean;
58 /** TODO */
59 maxCachedSessions?: number;
60 /** TODO */
61 maxRedirections?: number;
62 /** TODO */
63 connect?: buildConnector.BuildOptions | buildConnector.connector;
64 /** TODO */
65 maxRequestsPerClient?: number;
66 /** TODO */
67 localAddress?: string;
68 /** Max response body size in bytes, -1 is disabled */
69 maxResponseSize?: number;
70 /** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
71 autoSelectFamily?: boolean;
72 /** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
73 autoSelectFamilyAttemptTimeout?: number;
74 /**
75 * @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
76 * @default false
77 */
78 allowH2?: boolean;
79 /**
80 * @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
81 * @default 100
82 */
83 maxConcurrentStreams?: number
84 }
85 export interface SocketInfo {
86 localAddress?: string
87 localPort?: number
88 remoteAddress?: string
89 remotePort?: number
90 remoteFamily?: string
91 timeout?: number
92 bytesWritten?: number
93 bytesRead?: number
94 }
95}
96
97export default Client;
Note: See TracBrowser for help on using the repository browser.