@wiajs/request 3.0.19 → 3.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types/ZlibTransform.d.ts +6 -0
- package/types/caseless.d.ts +10 -0
- package/types/index.d.ts +14 -0
- package/types/request.d.ts +81 -0
- package/types/utils.d.ts +46 -0
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function httpify(resp: any, headers: any): Caseless;
|
|
2
|
+
export default class Caseless {
|
|
3
|
+
constructor(dict: any);
|
|
4
|
+
dict: any;
|
|
5
|
+
set(name: any, value: any, clobber: any): string | false;
|
|
6
|
+
has(name: string): string | false;
|
|
7
|
+
get(name: string): any;
|
|
8
|
+
swap(name: string): void;
|
|
9
|
+
del(name: string): boolean;
|
|
10
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default request;
|
|
2
|
+
declare function request(uri: any, options: any, callback: any): Request;
|
|
3
|
+
declare namespace request {
|
|
4
|
+
export let get: Request;
|
|
5
|
+
export let head: Request;
|
|
6
|
+
export let options: Request;
|
|
7
|
+
export let post: Request;
|
|
8
|
+
export let put: Request;
|
|
9
|
+
export let patch: Request;
|
|
10
|
+
export let del: Request;
|
|
11
|
+
let _delete: Request;
|
|
12
|
+
export { _delete as delete };
|
|
13
|
+
}
|
|
14
|
+
import Request from './request.js';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export default class Request extends stream.Duplex {
|
|
2
|
+
constructor(opts: Opts, resCallback: any);
|
|
3
|
+
_timeout: NodeJS.Timeout;
|
|
4
|
+
socket: any;
|
|
5
|
+
_currentRequest: http.ClientRequest;
|
|
6
|
+
response: Response;
|
|
7
|
+
responseStream: stream.Readable;
|
|
8
|
+
timing: boolean;
|
|
9
|
+
responseStarted: boolean;
|
|
10
|
+
responseStartTime: number;
|
|
11
|
+
_destdata: boolean;
|
|
12
|
+
_paused: boolean;
|
|
13
|
+
_respended: boolean;
|
|
14
|
+
pipesrc: stream.Readable;
|
|
15
|
+
pipedests: stream.Writable[];
|
|
16
|
+
startTimer: any;
|
|
17
|
+
opt: Opts;
|
|
18
|
+
pipefilter: any;
|
|
19
|
+
_currentUrl: string;
|
|
20
|
+
headers: {
|
|
21
|
+
[x: string]: string;
|
|
22
|
+
};
|
|
23
|
+
_ended: boolean;
|
|
24
|
+
_ending: boolean;
|
|
25
|
+
_redirectCount: number;
|
|
26
|
+
_redirects: any[];
|
|
27
|
+
_requestBodyLength: number;
|
|
28
|
+
_requestBodyBuffers: any[];
|
|
29
|
+
resCallback: any;
|
|
30
|
+
_onResponse: (res: Response) => void;
|
|
31
|
+
request(): http.ClientRequest;
|
|
32
|
+
abort(): void;
|
|
33
|
+
destroy(error: any): this;
|
|
34
|
+
override write(chunk: any, encodingOrCallback?: BufferEncoding | ((error: Error | null) => void), cb?: (error: Error | null) => void): boolean;
|
|
35
|
+
override end(chunk?: any, encoding?: BufferEncoding | (() => void), cb?: () => void): this;
|
|
36
|
+
hasHeader(name: string): boolean;
|
|
37
|
+
getHeader(name: string): string;
|
|
38
|
+
setHeader(name: string, value: string): void;
|
|
39
|
+
removeHeader(name: string): void;
|
|
40
|
+
get headersSent(): boolean;
|
|
41
|
+
setTimeout(msecs: any, callback: any): this;
|
|
42
|
+
sanitizeOptions(options: any): void;
|
|
43
|
+
processResponse(response: Response): void;
|
|
44
|
+
_isRedirect: boolean;
|
|
45
|
+
processStream(res: any): any;
|
|
46
|
+
override pipe<T>(dest: T & stream.Writable, opts?: {
|
|
47
|
+
end?: boolean;
|
|
48
|
+
}): T;
|
|
49
|
+
unpipe(dest: stream.Writable): this;
|
|
50
|
+
pipeDest(dest: any): void;
|
|
51
|
+
pause(): this;
|
|
52
|
+
resume(): this;
|
|
53
|
+
}
|
|
54
|
+
export type Opts = {
|
|
55
|
+
headers: {
|
|
56
|
+
[x: string]: string;
|
|
57
|
+
};
|
|
58
|
+
host: string;
|
|
59
|
+
method: string;
|
|
60
|
+
family: string;
|
|
61
|
+
path: string;
|
|
62
|
+
protocol: "http:" | "https:";
|
|
63
|
+
agent: any;
|
|
64
|
+
agents: any;
|
|
65
|
+
stream?: boolean;
|
|
66
|
+
decompress?: boolean;
|
|
67
|
+
transformStream?: any;
|
|
68
|
+
beforeRedirect?: any;
|
|
69
|
+
followRedirects?: boolean;
|
|
70
|
+
maxRedirects?: number;
|
|
71
|
+
maxBodyLength?: number;
|
|
72
|
+
trackRedirects?: any;
|
|
73
|
+
};
|
|
74
|
+
export type ResponseExt = {
|
|
75
|
+
redirects?: any[];
|
|
76
|
+
responseUrl?: string;
|
|
77
|
+
responseStartTime?: number;
|
|
78
|
+
};
|
|
79
|
+
export type Response = http.IncomingMessage & ResponseExt;
|
|
80
|
+
import stream from 'node:stream';
|
|
81
|
+
import http from 'node:http';
|
package/types/utils.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { createErrorType };
|
|
3
|
+
export { InvalidUrlError };
|
|
4
|
+
export { isString };
|
|
5
|
+
export { isArray };
|
|
6
|
+
export { isBuffer };
|
|
7
|
+
export { isUndefined };
|
|
8
|
+
export { isNumber };
|
|
9
|
+
export { isBoolean };
|
|
10
|
+
export { isFunction };
|
|
11
|
+
export { isObject };
|
|
12
|
+
export { isURL };
|
|
13
|
+
export { isReadStream };
|
|
14
|
+
export { noop };
|
|
15
|
+
export { parseUrl };
|
|
16
|
+
export { spreadUrlObject };
|
|
17
|
+
export { validateUrl };
|
|
18
|
+
export { resolveUrl };
|
|
19
|
+
export { noBody };
|
|
20
|
+
}
|
|
21
|
+
export default _default;
|
|
22
|
+
export type CustomErrorInstance = {
|
|
23
|
+
code: string;
|
|
24
|
+
message: string;
|
|
25
|
+
cause: Error | undefined;
|
|
26
|
+
};
|
|
27
|
+
declare function createErrorType(code: string, message: string, baseClass?: typeof Error): typeof Error & {
|
|
28
|
+
new (properties?: object): CustomErrorInstance;
|
|
29
|
+
};
|
|
30
|
+
declare const InvalidUrlError: ErrorConstructor & (new (properties?: object) => CustomErrorInstance);
|
|
31
|
+
declare function isString(thing: any): boolean;
|
|
32
|
+
declare const isArray: (arg: any) => arg is any[];
|
|
33
|
+
declare function isBuffer(val: any): boolean;
|
|
34
|
+
declare function isUndefined(thing: any): boolean;
|
|
35
|
+
declare function isNumber(thing: any): boolean;
|
|
36
|
+
declare function isBoolean(thing: any): boolean;
|
|
37
|
+
declare function isFunction(thing: any): boolean;
|
|
38
|
+
declare function isObject(thing: any): boolean;
|
|
39
|
+
declare function isURL(value: any): boolean;
|
|
40
|
+
declare function isReadStream(rs: any): any;
|
|
41
|
+
declare function noop(): void;
|
|
42
|
+
declare function parseUrl(input: any): any;
|
|
43
|
+
declare function spreadUrlObject(urlObject: any, target: any): any;
|
|
44
|
+
declare function validateUrl(input: any): any;
|
|
45
|
+
declare function resolveUrl(relative: any, base: any): any;
|
|
46
|
+
declare function noBody(method: string, code: number): boolean;
|