abbot-http-client 0.0.57 → 0.0.58

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
@@ -258,11 +258,13 @@ var AbbotHttp = class extends AxiosBase {
258
258
  axios2.interceptors.request.use(
259
259
  (config) => {
260
260
  const req = { ...config };
261
+ req.responseType = option?.responseType ?? "json";
262
+ if (this.config.devMode) {
263
+ const method = req.method?.toLowerCase() || "";
264
+ const payload = method === "get" ? req.params : req.data;
265
+ axios2.log.logRequest(req.url ?? "", payload);
266
+ }
261
267
  if (req.method && req.method.toLowerCase() === "post") {
262
- req.responseType = option?.responseType ?? "json";
263
- if (this.config.devMode) {
264
- axios2.log.logRequest(config.url ?? "", req.data);
265
- }
266
268
  if (req.data) {
267
269
  if (req.data instanceof FormData) {
268
270
  if (req.data.get("param")) {
@@ -393,7 +395,7 @@ var AbbotHttp = class extends AxiosBase {
393
395
  };
394
396
  if (error.code === "ECONNABORTED") {
395
397
  err.response.code = -1;
396
- err.response.message = "\u0E01\u0E32\u0E23\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E43\u0E0A\u0E49\u0E40\u0E27\u0E25\u0E32\u0E19\u0E32\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B";
398
+ err.response.message = "\u0E01\u0E32\u0E23\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E43\u0E0A\u0E49\u0E40\u0E27\u0E25\u0E32\u0E19\u0E32\u0E19\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B";
397
399
  err.response.detail = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07";
398
400
  } else if (error.code === "ERR_NETWORK") {
399
401
  err.response.code = -2;
package/dist/index.js CHANGED
@@ -211,11 +211,13 @@ var AbbotHttp = class extends AxiosBase {
211
211
  axios2.interceptors.request.use(
212
212
  (config) => {
213
213
  const req = { ...config };
214
+ req.responseType = option?.responseType ?? "json";
215
+ if (this.config.devMode) {
216
+ const method = req.method?.toLowerCase() || "";
217
+ const payload = method === "get" ? req.params : req.data;
218
+ axios2.log.logRequest(req.url ?? "", payload);
219
+ }
214
220
  if (req.method && req.method.toLowerCase() === "post") {
215
- req.responseType = option?.responseType ?? "json";
216
- if (this.config.devMode) {
217
- axios2.log.logRequest(config.url ?? "", req.data);
218
- }
219
221
  if (req.data) {
220
222
  if (req.data instanceof FormData) {
221
223
  if (req.data.get("param")) {
@@ -346,7 +348,7 @@ var AbbotHttp = class extends AxiosBase {
346
348
  };
347
349
  if (error.code === "ECONNABORTED") {
348
350
  err.response.code = -1;
349
- err.response.message = "\u0E01\u0E32\u0E23\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E43\u0E0A\u0E49\u0E40\u0E27\u0E25\u0E32\u0E19\u0E32\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B";
351
+ err.response.message = "\u0E01\u0E32\u0E23\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E43\u0E0A\u0E49\u0E40\u0E27\u0E25\u0E32\u0E19\u0E32\u0E19\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B";
350
352
  err.response.detail = "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07";
351
353
  } else if (error.code === "ERR_NETWORK") {
352
354
  err.response.code = -2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abbot-http-client",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
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",