deeke-script-app 1.6.9 → 1.7.1
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.
|
@@ -4,38 +4,91 @@ declare global {
|
|
|
4
4
|
|
|
5
5
|
interface Http {
|
|
6
6
|
/**
|
|
7
|
-
* post请求
|
|
8
|
-
* @param url 请求地址
|
|
9
|
-
* @param json 请求内容,请使用JOSN.parse()将对象处理成字符串
|
|
10
|
-
*/
|
|
11
|
-
public post(url: string, json: object): string;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
7
|
+
* post请求
|
|
15
8
|
* @param url 请求地址
|
|
16
9
|
* @param json 请求内容
|
|
17
10
|
* @param headers 请求头n的请求头,如:{"Content-Type":"application/json"}
|
|
18
11
|
*/
|
|
19
|
-
public
|
|
12
|
+
public post(url: string, json: object, headers?: object): string | null;
|
|
20
13
|
|
|
21
14
|
/**
|
|
22
15
|
* get请求
|
|
23
16
|
* @param url 请求地址
|
|
17
|
+
* @param headers 请求头
|
|
24
18
|
*/
|
|
25
|
-
public get(url: string): string;
|
|
19
|
+
public get(url: string, headers: object): string | null;
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
*
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
29
23
|
* @param url 请求地址
|
|
30
|
-
* @param
|
|
24
|
+
* @param files
|
|
25
|
+
* @param params
|
|
26
|
+
* @param httpCallback
|
|
31
27
|
*/
|
|
32
|
-
public getHeaders(url: string, headers: object): string | null;
|
|
33
|
-
|
|
34
|
-
//下面的方法,暂时还没使用过
|
|
35
28
|
public postFile(url: string, files: string[], params: object, httpCallback: {
|
|
36
29
|
success: (response: any) => void,
|
|
37
30
|
fail: (response: any) => void
|
|
38
31
|
}): void;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 下载文件
|
|
36
|
+
* @param url 下载链接
|
|
37
|
+
* @param destPath 保存路径(含文件名称)
|
|
38
|
+
* @param headers 请求头
|
|
39
|
+
*/
|
|
40
|
+
public download(url: string, destPath: string, headers?: object): string | null;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 设置连接超时时间
|
|
44
|
+
* @param seconds 超时时间(秒),默认10秒
|
|
45
|
+
*/
|
|
46
|
+
public setConnectTimeout(seconds: number): void;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 设置读取超时时间
|
|
50
|
+
* @param seconds 超时时间(秒),默认30秒
|
|
51
|
+
*/
|
|
52
|
+
public setReadTimeout(seconds: number): void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 设置写入超时时间
|
|
56
|
+
* @param seconds 超时时间(秒),默认30秒
|
|
57
|
+
*/
|
|
58
|
+
public setWriteTimeout(seconds: number): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 设置所有超时时间
|
|
62
|
+
* @param connectSeconds 连接超时时间(秒)
|
|
63
|
+
* @param readSeconds 读取超时时间(秒)
|
|
64
|
+
* @param writeSeconds 写入超时时间(秒)
|
|
65
|
+
*/
|
|
66
|
+
public setTimeout(connectSeconds: number, readSeconds: number, writeSeconds: number): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 设置所有超时时间为相同的值
|
|
70
|
+
* @param seconds 超时时间(秒),将应用于连接、读取和写入
|
|
71
|
+
*/
|
|
72
|
+
public setTimeout(seconds: number): void;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 流式POST请求(支持Server-Sent Events等流式输出)
|
|
76
|
+
* @param url 请求URL
|
|
77
|
+
* @param json 请求体JSON对象
|
|
78
|
+
* @param headers 请求头(可选)
|
|
79
|
+
* @param onData 数据回调函数,每收到一行数据时调用,参数为数据字符串
|
|
80
|
+
* @param onError 错误回调函数,发生错误时调用,参数为错误信息
|
|
81
|
+
*/
|
|
82
|
+
public postStream(url: string, json: object, headers: object, onData: (data: string) => void, onError: (error: string) => void): void;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 流式POST请求(支持Server-Sent Events等流式输出)
|
|
86
|
+
* @param url 请求URL
|
|
87
|
+
* @param json 请求体JSON对象
|
|
88
|
+
* @param onData 数据回调函数,每收到一行数据时调用,参数为数据字符串
|
|
89
|
+
* @param onError 错误回调函数,发生错误时调用,参数为错误信息
|
|
90
|
+
*/
|
|
91
|
+
public postStream(url: string, json: object, onData: (data: string) => void, onError: (error: string) => void): void;
|
|
39
92
|
}
|
|
40
93
|
|
|
41
94
|
export { };
|
package/package.json
CHANGED
|
File without changes
|