1 |
|
2 | import { ProgressEvent } from './progress-event';
|
3 | import { InvalidStateError, NetworkError, SecurityError, SyntaxError } from './errors';
|
4 | import { ProgressEventListener, XMLHttpRequestEventTarget } from './xml-http-request-event-target';
|
5 | import { XMLHttpRequestUpload } from './xml-http-request-upload';
|
6 | import { Url } from 'url';
|
7 | import { Agent as HttpAgent } from 'http';
|
8 | import { Agent as HttpsAgent } from 'https';
|
9 | export interface XMLHttpRequestOptions {
|
10 | anon?: boolean;
|
11 | }
|
12 | export interface XHRUrl extends Url {
|
13 | method?: string;
|
14 | }
|
15 | export declare class XMLHttpRequest extends XMLHttpRequestEventTarget {
|
16 | static ProgressEvent: typeof ProgressEvent;
|
17 | static InvalidStateError: typeof InvalidStateError;
|
18 | static NetworkError: typeof NetworkError;
|
19 | static SecurityError: typeof SecurityError;
|
20 | static SyntaxError: typeof SyntaxError;
|
21 | static XMLHttpRequestUpload: typeof XMLHttpRequestUpload;
|
22 | static UNSENT: number;
|
23 | static OPENED: number;
|
24 | static HEADERS_RECEIVED: number;
|
25 | static LOADING: number;
|
26 | static DONE: number;
|
27 | static cookieJar: any;
|
28 | UNSENT: number;
|
29 | OPENED: number;
|
30 | HEADERS_RECEIVED: number;
|
31 | LOADING: number;
|
32 | DONE: number;
|
33 | onreadystatechange: ProgressEventListener | null;
|
34 | readyState: number;
|
35 | response: string | ArrayBuffer | Buffer | object | null;
|
36 | responseText: string;
|
37 | responseType: string;
|
38 | status: number;
|
39 | statusText: string;
|
40 | timeout: number;
|
41 | upload: XMLHttpRequestUpload;
|
42 | responseUrl: string;
|
43 | withCredentials: boolean;
|
44 | nodejsHttpAgent: HttpsAgent;
|
45 | nodejsHttpsAgent: HttpsAgent;
|
46 | nodejsBaseUrl: string | null;
|
47 | private _anonymous;
|
48 | private _method;
|
49 | private _url;
|
50 | private _sync;
|
51 | private _headers;
|
52 | private _loweredHeaders;
|
53 | private _mimeOverride;
|
54 | private _request;
|
55 | private _response;
|
56 | private _responseParts;
|
57 | private _responseHeaders;
|
58 | private _aborting;
|
59 | private _error;
|
60 | private _loadedBytes;
|
61 | private _totalBytes;
|
62 | private _lengthComputable;
|
63 | private _restrictedMethods;
|
64 | private _restrictedHeaders;
|
65 | private _privateHeaders;
|
66 | private _userAgent;
|
67 | constructor(options?: XMLHttpRequestOptions);
|
68 | open(method: string, url: string, async?: boolean, user?: string, password?: string): void;
|
69 | setRequestHeader(name: string, value: any): void;
|
70 | send(data?: string | ArrayBuffer): void;
|
71 | abort(): void;
|
72 | getResponseHeader(name: string): string;
|
73 | getAllResponseHeaders(): string;
|
74 | overrideMimeType(mimeType: string): void;
|
75 | nodejsSet(options: {
|
76 | httpAgent?: HttpAgent;
|
77 | httpsAgent?: HttpsAgent;
|
78 | baseUrl?: string;
|
79 | }): void;
|
80 | static nodejsSet(options: {
|
81 | httpAgent?: HttpAgent;
|
82 | httpsAgent?: HttpsAgent;
|
83 | baseUrl?: string;
|
84 | }): void;
|
85 | private _setReadyState(readyState);
|
86 | private _sendFile(data);
|
87 | private _sendHttp(data?);
|
88 | private _sendHxxpRequest();
|
89 | private _finalizeHeaders();
|
90 | private _onHttpResponse(request, response);
|
91 | private _onHttpResponseData(response, data);
|
92 | private _onHttpResponseEnd(response);
|
93 | private _onHttpResponseClose(response);
|
94 | private _onHttpTimeout(request);
|
95 | private _onHttpRequestError(request, error);
|
96 | private _dispatchProgress(eventType);
|
97 | private _setError();
|
98 | private _parseUrl(urlString, user?, password?);
|
99 | private _parseResponseHeaders(response);
|
100 | private _parseResponse();
|
101 | private _parseResponseEncoding();
|
102 | }
|