@ikonintegration/mod-license-client 2.0.41 → 2.0.43

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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonintegration/mod-license-client",
3
- "version": "2.0.41",
3
+ "version": "2.0.43",
4
4
  "description": "Shared module license API client",
5
5
  "main": "index.js",
6
6
  "scripts": {