cshenfu
2024-05-21 09d8c671d5e6e6045677bfb5218a5fb78c26aa0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { IncomingMessage, Agent, OutgoingHttpHeaders } from "http";
import { Readable } from "stream";
 
export interface Options {
    'method'?: string;
    'readTimeout'?: number;
    'connectTimeout'?: number;
    'timeout'?: number;
    'agent'?: Agent;
    'headers'?: OutgoingHttpHeaders;
    'rejectUnauthorized'?: boolean;
    'compression'?: boolean;
    'beforeRequest'?(options: Options): void;
    'data'?: string | Buffer | Readable | undefined;
    'key'?: string;
    'cert'?: string;
    'ca'?: string;
}
 
export function request(url: string, options: Options): Promise<IncomingMessage>;
 
export function read(response: IncomingMessage, encoding: string): Promise<string|Buffer>;
 
export interface Event {
    'data'?: string;
    'id'?: string;
    'event'?: string;
    'retry'?: number;
}
 
export function readAsSSE(response: IncomingMessage): AsyncGenerator<Event, void, unknown>;