@less-is-more/less-js 1.5.2-2 → 1.5.3-0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/service.js +6 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@less-is-more/less-js",
3
- "version": "1.5.2-2",
3
+ "version": "1.5.3-0",
4
4
  "description": "Fast develop kit for nodejs",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/service.js CHANGED
@@ -36,14 +36,15 @@ module.exports = class Service {
36
36
  path,
37
37
  params,
38
38
  async = false,
39
- asyncDelaySecond = 0
39
+ asyncDelaySecond = 0,
40
40
  ) {
41
41
  let url = this.#urlPrefix.replace("SERVICE", serviceName) + path;
42
42
  try {
43
43
  if (params) {
44
44
  url += "?" + qs.stringify(params);
45
45
  }
46
- const headers = this.setDelay(async, asyncDelaySecond);
46
+ let headers = this.setDelay(async, asyncDelaySecond);
47
+ headers["accept-encoding"] = "gzip";
47
48
  const result = await axios.get(url, { headers });
48
49
  return result.data;
49
50
  } catch (e) {
@@ -58,7 +59,7 @@ module.exports = class Service {
58
59
  params = {},
59
60
  async = false,
60
61
  asyncDelaySecond = 0,
61
- formFormat = true
62
+ formFormat = true,
62
63
  ) {
63
64
  let url = this.#urlPrefix.replace("SERVICE", serviceName) + path;
64
65
  try {
@@ -66,12 +67,13 @@ module.exports = class Service {
66
67
  if (!formFormat) {
67
68
  headers["Content-Type"] = "application/json";
68
69
  }
70
+ headers["accept-encoding"] = "gzip";
69
71
  const result = await axios.post(
70
72
  url,
71
73
  formFormat ? qs.stringify(params) : params,
72
74
  {
73
75
  headers,
74
- }
76
+ },
75
77
  );
76
78
  return result.data;
77
79
  } catch (e) {