@zwa73/utils 1.0.179 → 1.0.180

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 CHANGED
@@ -20,7 +20,7 @@ export type ComReqOpt = {
20
20
  /**请求域名 */
21
21
  hostname: string;
22
22
  /**请求路径 */
23
- path: string;
23
+ path?: string;
24
24
  /**请求方式 post 为 */
25
25
  method: 'POST' | 'GET';
26
26
  /**端口 */
package/dist/UtilCom.js CHANGED
@@ -88,7 +88,7 @@ var UtilCom;
88
88
  const queryString = querystring_1.default.stringify(reqData);
89
89
  if (queryString) {
90
90
  // 检查当前路径是否已经包含问号
91
- const separator = comReqOpt.path.includes('?') ? '&' : '?';
91
+ const separator = comReqOpt?.path?.includes('?') ? '&' : '?';
92
92
  comReqOpt.path += separator + queryString;
93
93
  }
94
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/utils",
3
- "version": "1.0.179",
3
+ "version": "1.0.180",
4
4
  "description": "my utils",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/UtilCom.ts CHANGED
@@ -25,7 +25,7 @@ export type ComReqOpt = {
25
25
  /**请求域名 */
26
26
  hostname: string;
27
27
  /**请求路径 */
28
- path: string;
28
+ path?: string;
29
29
  /**请求方式 post 为 */
30
30
  method: 'POST'|'GET';
31
31
  /**端口 */
@@ -147,7 +147,7 @@ async function jsonReq<T extends ComReqOpt>(
147
147
  const queryString = qs.stringify(reqData as GetReqData);
148
148
  if (queryString) {
149
149
  // 检查当前路径是否已经包含问号
150
- const separator = comReqOpt.path.includes('?') ? '&' : '?';
150
+ const separator = comReqOpt?.path?.includes('?') ? '&' : '?';
151
151
  comReqOpt.path += separator + queryString;
152
152
  }
153
153
  }