1 |
|
2 |
|
3 |
|
4 |
|
5 | export interface XHROptions {
|
6 | type?: string;
|
7 | url: string;
|
8 | user?: string;
|
9 | password?: string;
|
10 | headers?: Headers;
|
11 | timeout?: number;
|
12 | data?: string;
|
13 | strictSSL?: boolean;
|
14 | followRedirects?: number;
|
15 | token?: CancellationToken;
|
16 | agent?: HttpProxyAgent | HttpsProxyAgent;
|
17 | }
|
18 |
|
19 | export interface XHRResponse {
|
20 | readonly responseText: string;
|
21 | readonly body: Uint8Array;
|
22 | readonly status: number;
|
23 | readonly headers: Headers;
|
24 | }
|
25 |
|
26 | export interface XHRRequest {
|
27 | (options: XHROptions): Promise<XHRResponse>
|
28 | }
|
29 |
|
30 | export interface XHRConfigure {
|
31 | (proxyUrl: string | undefined, strictSSL: boolean): void;
|
32 | }
|
33 |
|
34 | export interface Disposable {
|
35 | |
36 |
|
37 |
|
38 | dispose(): void;
|
39 | }
|
40 |
|
41 |
|
42 |
|
43 | export interface Event<T> {
|
44 | |
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;
|
52 | }
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | export interface CancellationToken {
|
59 | |
60 |
|
61 |
|
62 | readonly isCancellationRequested: boolean;
|
63 | |
64 |
|
65 |
|
66 | readonly onCancellationRequested: Event<any>;
|
67 | }
|
68 |
|
69 | export type HttpProxyAgent = any;
|
70 |
|
71 | export type HttpsProxyAgent = any;
|
72 |
|
73 | export type Headers = { [header: string]: string | string[] | undefined };
|
74 |
|
75 | export declare const configure: XHRConfigure;
|
76 | export declare const xhr: XHRRequest;
|
77 |
|
78 | export declare function getErrorStatusDescription(status: number): string;
|