@ikonintegration/mod-license-client 2.0.40 → 2.0.42

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.
@@ -44,12 +44,13 @@ export default class APIRequest {
44
44
  redirect: 'follow',
45
45
  ...(Object.keys(this.headers).length > 0 ? { headers: this.headers } : {}),
46
46
  };
47
- if (this.bodyType == 'JSON') {
47
+ if (this.bodyType == 'JSON' || this.bodyType == 'JSON/BLOB') {
48
48
  if (Object.keys(this.body).length > 0) request.body = JSON.stringify(this.body);
49
+ else if (['POST', 'PUT', 'PATCH'].includes(this.method.toUpperCase())) request.body = JSON.stringify({})
49
50
  } else if (this.bodyType == 'BINARY') {
50
- if (this.body && this.body.length > 0) request.body = this.body;
51
+ if (['POST', 'PUT', 'PATCH'].includes(this.method.toUpperCase()) && this.body && this.body.length > 0) request.body = this.body;
51
52
  } else {
52
- if (this.body) request.body = this.body;
53
+ if (['POST', 'PUT', 'PATCH'].includes(this.method.toUpperCase()) && this.body) request.body = this.body;
53
54
  }
54
55
  return request;
55
56
  }
@@ -57,8 +58,10 @@ export default class APIRequest {
57
58
  const contentType = respObj.headers.get('Content-Type');
58
59
  if (contentType && contentType.includes('json')) {
59
60
  return { body: await respObj.json(), statusCode: respObj.status };
60
- } else if ((contentType && contentType.includes('image')) || this.bodyType == 'BINARY') {
61
+ } else if (this.bodyType == 'BLOB' || this.bodyType == 'JSON/BLOB') {
61
62
  return { body: await respObj.blob(), statusCode: respObj.status };
62
- } return { body: await respObj.text(), statusCode: respObj.status };
63
+ } else if (contentType && contentType.includes('image') || this.bodyType == 'BINARY') {
64
+ return { body: await respObj.text(), statusCode: respObj.status };
65
+ } return { body: await respObj.json(), statusCode: respObj.status };
63
66
  }
64
67
  }
@@ -111,6 +111,7 @@ export default class Order {
111
111
  async exportOrderRefunds(filterObj) {
112
112
  const req = await this.api.newBaseRequest("POST");
113
113
  req.path = `/orders/refunds/export`;
114
+ req.bodyType = "BLOB";
114
115
  req.body = { ...filterObj };
115
116
  return await req.exec();
116
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonintegration/mod-license-client",
3
- "version": "2.0.40",
3
+ "version": "2.0.42",
4
4
  "description": "Shared module license API client",
5
5
  "main": "index.js",
6
6
  "scripts": {