-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttpreq.d.ts
41 lines (37 loc) · 1.28 KB
/
httpreq.d.ts
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
32
33
34
35
36
37
38
39
40
41
declare module 'httpreq' {
declare type Callback = (err: Error | null | undefined, res?: Result) => void;
interface Result {
headers: Record<string, string>;
body: unknown;
statusCode: number;
[key: string]: any;
}
declare interface Options {
readonly parameters?: Record<string, unknown>;
readonly json?: boolean;
readonly files?: Record<string, unknown>;
readonly body?: unknown;
readonly headers?: Record<string, unknown>;
readonly cookies?: ReadonlyArray<string>;
readonly auth?: unknown;
readonly binary?: boolean;
readonly allowRedirects?: boolean;
readonly maxRedirects?: number;
readonly encodePostParameters?: boolean;
readonly timeout?: number;
readonly proxy?: unknown;
readonly host?: string;
readonly port?: number;
readonly protocol?: 'http' | 'https';
readonly rejectUnauthorized?: boolean;
}
declare function RequestFunction(url: string, options: Options, callback: Callback): void;
export = {
get: RequestFunction,
put: RequestFunction,
patch: RequestFunction,
post: RequestFunction,
delete: RequestFunction,
options: RequestFunction,
};
}