abbot-http-client 0.0.56 → 0.0.57
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/index.cjs +8 -10
- package/dist/index.js +8 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -296,20 +296,18 @@ var AbbotHttp = class extends AxiosBase {
|
|
|
296
296
|
axios2.interceptors.response.use(
|
|
297
297
|
async (response) => {
|
|
298
298
|
const res = { ...response };
|
|
299
|
+
const contentType = response.headers["content-type"];
|
|
299
300
|
if (option?.isDownload) {
|
|
300
301
|
const contentTypes = ["application/json", "text/plain"];
|
|
301
|
-
if (contentTypes.includes(response.
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
axios2.log.logResponse(res.data);
|
|
306
|
-
}
|
|
302
|
+
if (contentTypes.includes(contentType) && response.data instanceof Blob) {
|
|
303
|
+
res.data = cryp.decrypt(await response.data.text());
|
|
304
|
+
} else {
|
|
305
|
+
res.data = response.data;
|
|
307
306
|
}
|
|
307
|
+
} else {
|
|
308
|
+
res.data = cryp.decrypt(response.data);
|
|
308
309
|
}
|
|
309
|
-
|
|
310
|
-
if (this.config.devMode) {
|
|
311
|
-
axios2.log.logResponse(res.data);
|
|
312
|
-
}
|
|
310
|
+
if (this.config.devMode) axios2.log.logResponse(res.data);
|
|
313
311
|
return res;
|
|
314
312
|
},
|
|
315
313
|
(error) => {
|
package/dist/index.js
CHANGED
|
@@ -249,20 +249,18 @@ var AbbotHttp = class extends AxiosBase {
|
|
|
249
249
|
axios2.interceptors.response.use(
|
|
250
250
|
async (response) => {
|
|
251
251
|
const res = { ...response };
|
|
252
|
+
const contentType = response.headers["content-type"];
|
|
252
253
|
if (option?.isDownload) {
|
|
253
254
|
const contentTypes = ["application/json", "text/plain"];
|
|
254
|
-
if (contentTypes.includes(response.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
axios2.log.logResponse(res.data);
|
|
259
|
-
}
|
|
255
|
+
if (contentTypes.includes(contentType) && response.data instanceof Blob) {
|
|
256
|
+
res.data = cryp.decrypt(await response.data.text());
|
|
257
|
+
} else {
|
|
258
|
+
res.data = response.data;
|
|
260
259
|
}
|
|
260
|
+
} else {
|
|
261
|
+
res.data = cryp.decrypt(response.data);
|
|
261
262
|
}
|
|
262
|
-
|
|
263
|
-
if (this.config.devMode) {
|
|
264
|
-
axios2.log.logResponse(res.data);
|
|
265
|
-
}
|
|
263
|
+
if (this.config.devMode) axios2.log.logResponse(res.data);
|
|
266
264
|
return res;
|
|
267
265
|
},
|
|
268
266
|
(error) => {
|