1 | import { URL, UrlObject } from 'url'
|
---|
2 | import { Duplex } from 'stream'
|
---|
3 | import Dispatcher from './dispatcher'
|
---|
4 |
|
---|
5 | export {
|
---|
6 | request,
|
---|
7 | stream,
|
---|
8 | pipeline,
|
---|
9 | connect,
|
---|
10 | upgrade,
|
---|
11 | }
|
---|
12 |
|
---|
13 | /** Performs an HTTP request. */
|
---|
14 | declare function request(
|
---|
15 | url: string | URL | UrlObject,
|
---|
16 | options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>,
|
---|
17 | ): Promise<Dispatcher.ResponseData>;
|
---|
18 |
|
---|
19 | /** A faster version of `request`. */
|
---|
20 | declare function stream(
|
---|
21 | url: string | URL | UrlObject,
|
---|
22 | options: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions, 'origin' | 'path'>,
|
---|
23 | factory: Dispatcher.StreamFactory
|
---|
24 | ): Promise<Dispatcher.StreamData>;
|
---|
25 |
|
---|
26 | /** For easy use with `stream.pipeline`. */
|
---|
27 | declare function pipeline(
|
---|
28 | url: string | URL | UrlObject,
|
---|
29 | options: { dispatcher?: Dispatcher } & Omit<Dispatcher.PipelineOptions, 'origin' | 'path'>,
|
---|
30 | handler: Dispatcher.PipelineHandler
|
---|
31 | ): Duplex;
|
---|
32 |
|
---|
33 | /** Starts two-way communications with the requested resource. */
|
---|
34 | declare function connect(
|
---|
35 | url: string | URL | UrlObject,
|
---|
36 | options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.ConnectOptions, 'origin' | 'path'>
|
---|
37 | ): Promise<Dispatcher.ConnectData>;
|
---|
38 |
|
---|
39 | /** Upgrade to a different protocol. */
|
---|
40 | declare function upgrade(
|
---|
41 | url: string | URL | UrlObject,
|
---|
42 | options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.UpgradeOptions, 'origin' | 'path'>
|
---|
43 | ): Promise<Dispatcher.UpgradeData>;
|
---|