| | |
| | | import { URL } from 'url' |
| | | import { Duplex, Readable, Writable } from 'stream' |
| | | import { EventEmitter } from 'events' |
| | | import { Blob } from 'buffer' |
| | | import { URL } from 'node:url' |
| | | import { Duplex, Readable, Writable } from 'node:stream' |
| | | import { EventEmitter } from 'node:events' |
| | | import { Blob } from 'node:buffer' |
| | | import { IncomingHttpHeaders } from './header' |
| | | import BodyReadable from './readable' |
| | | import { FormData } from './formdata' |
| | |
| | | /** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */ |
| | | dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean |
| | | /** Starts two-way communications with the requested resource. */ |
| | | connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>> |
| | | connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void |
| | | connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>> |
| | | /** Compose a chain of dispatchers */ |
| | | compose (dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher |
| | | compose (...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher |
| | | /** Performs an HTTP request. */ |
| | | request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>> |
| | | request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void |
| | | request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>> |
| | | /** For easy use with `stream.pipeline`. */ |
| | | pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex |
| | | /** A faster version of `Dispatcher.request`. */ |
| | | stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>> |
| | | stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void |
| | | stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>> |
| | | /** Upgrade to a different protocol. */ |
| | | upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData> |
| | | upgrade (options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void |
| | | upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData> |
| | | /** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */ |
| | | close (): Promise<void> |
| | | close (callback: () => void): void |
| | | close (): Promise<void> |
| | | /** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */ |
| | | destroy (): Promise<void> |
| | | destroy (err: Error | null): Promise<void> |
| | | destroy (callback: () => void): void |
| | | destroy (err: Error | null, callback: () => void): void |
| | | destroy (callback: () => void): void |
| | | destroy (err: Error | null): Promise<void> |
| | | destroy (): Promise<void> |
| | | |
| | | on (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this |
| | | on (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this |