@zwa73/utils 1.0.185 → 1.0.186
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.js +2 -2
- package/package.json +1 -1
- package/src/UtilCom.ts +2 -2
package/dist/UtilCom.js
CHANGED
|
@@ -102,12 +102,12 @@ var UtilCom;
|
|
|
102
102
|
if (result == undefined)
|
|
103
103
|
return undefined;
|
|
104
104
|
const { data, ...rest } = result;
|
|
105
|
-
if (data == "") {
|
|
105
|
+
if (data.trim() == "") {
|
|
106
106
|
UtilLogger_1.SLogger.warn(`${jsonReq.name} 接收反馈错误: 原始字符串为空`);
|
|
107
107
|
return undefined;
|
|
108
108
|
}
|
|
109
109
|
try {
|
|
110
|
-
const obj = JSON.parse(data);
|
|
110
|
+
const obj = JSON.parse(data.trim());
|
|
111
111
|
UtilLogger_1.SLogger.http(`${jsonReq.name} 接受信息:`, UtilFunctions_1.UtilFunc.stringifyJToken(obj, { compress: true, space: 2 }));
|
|
112
112
|
return { ...rest, data: obj };
|
|
113
113
|
}
|
package/package.json
CHANGED
package/src/UtilCom.ts
CHANGED
|
@@ -162,13 +162,13 @@ async function jsonReq<T extends ComReqOpt>(
|
|
|
162
162
|
if(result==undefined) return undefined;
|
|
163
163
|
const {data,...rest} = result;
|
|
164
164
|
|
|
165
|
-
if(data==""){
|
|
165
|
+
if(data.trim()==""){
|
|
166
166
|
SLogger.warn(`${jsonReq.name} 接收反馈错误: 原始字符串为空`);
|
|
167
167
|
return undefined;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
try{
|
|
171
|
-
const obj = JSON.parse(data) as JObject;
|
|
171
|
+
const obj = JSON.parse(data.trim()) as JObject;
|
|
172
172
|
SLogger.http(`${jsonReq.name} 接受信息:`,UtilFunc.stringifyJToken(obj,{compress:true,space:2}));
|
|
173
173
|
return{...rest,data:obj};
|
|
174
174
|
}
|