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 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.headers["content-type"])) {
302
- const result = response.data instanceof Blob ? await response.data.text() : response.data;
303
- res.data = cryp.decrypt(result);
304
- if (this.config.devMode) {
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
- res.data = cryp.decrypt(response.data);
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.headers["content-type"])) {
255
- const result = response.data instanceof Blob ? await response.data.text() : response.data;
256
- res.data = cryp.decrypt(result);
257
- if (this.config.devMode) {
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
- res.data = cryp.decrypt(response.data);
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abbot-http-client",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "description": "This package helps Abbot team to handle all the axios requests.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",