@zwa73/utils 1.0.177 → 1.0.178
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/dist/UtilCom.d.ts +1 -1
- package/dist/UtilCom.js +2 -2
- package/package.json +1 -1
- package/src/UtilCom.ts +2 -3
package/dist/UtilCom.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type GetReqData = NodeJS.Dict<string | number | boolean | readonly string
|
|
|
39
39
|
export declare namespace UtilCom {
|
|
40
40
|
/**网络请求
|
|
41
41
|
* @param comReqOpt - 网络请求选项
|
|
42
|
-
* @param procReq - 请求处理函数
|
|
42
|
+
* @param procReq - 请求处理函数 需调用req.end()
|
|
43
43
|
* @param reduceData - 数据处理函数
|
|
44
44
|
* @param initData - 初始数据
|
|
45
45
|
*/
|
package/dist/UtilCom.js
CHANGED
|
@@ -14,7 +14,7 @@ var UtilCom;
|
|
|
14
14
|
(function (UtilCom) {
|
|
15
15
|
/**网络请求
|
|
16
16
|
* @param comReqOpt - 网络请求选项
|
|
17
|
-
* @param procReq - 请求处理函数
|
|
17
|
+
* @param procReq - 请求处理函数 需调用req.end()
|
|
18
18
|
* @param reduceData - 数据处理函数
|
|
19
19
|
* @param initData - 初始数据
|
|
20
20
|
*/
|
|
@@ -75,7 +75,6 @@ var UtilCom;
|
|
|
75
75
|
resolve(undefined);
|
|
76
76
|
});
|
|
77
77
|
await procReq(req);
|
|
78
|
-
req.end();
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
80
|
UtilCom.comReq = comReq;
|
|
@@ -92,6 +91,7 @@ var UtilCom;
|
|
|
92
91
|
const procReq = (req) => {
|
|
93
92
|
if (isPost)
|
|
94
93
|
req.write(JSON.stringify(reqData));
|
|
94
|
+
req.end();
|
|
95
95
|
};
|
|
96
96
|
const reduceData = (acc, data) => acc + data;
|
|
97
97
|
const result = await comReq(comReqOpt, procReq, reduceData, "");
|
package/package.json
CHANGED
package/src/UtilCom.ts
CHANGED
|
@@ -56,7 +56,7 @@ export namespace UtilCom{
|
|
|
56
56
|
|
|
57
57
|
/**网络请求
|
|
58
58
|
* @param comReqOpt - 网络请求选项
|
|
59
|
-
* @param procReq - 请求处理函数
|
|
59
|
+
* @param procReq - 请求处理函数 需调用req.end()
|
|
60
60
|
* @param reduceData - 数据处理函数
|
|
61
61
|
* @param initData - 初始数据
|
|
62
62
|
*/
|
|
@@ -130,8 +130,6 @@ export async function comReq<T>(
|
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
await procReq(req);
|
|
133
|
-
|
|
134
|
-
req.end();
|
|
135
133
|
});
|
|
136
134
|
}
|
|
137
135
|
|
|
@@ -151,6 +149,7 @@ async function jsonReq<T extends ComReqOpt>(
|
|
|
151
149
|
|
|
152
150
|
const procReq = (req:http.ClientRequest)=>{
|
|
153
151
|
if(isPost) req.write(JSON.stringify(reqData));
|
|
152
|
+
req.end();
|
|
154
153
|
}
|
|
155
154
|
|
|
156
155
|
const reduceData = (acc:string,data:string)=>acc+data;
|