@caruuto/caruuto-js 0.2.0 → 0.2.1

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.
@@ -32,19 +32,23 @@ module.exports = function (CaruutoClient) {
32
32
  }
33
33
 
34
34
  if (requestObject.body) {
35
- options.body = requestObject.body
36
- }
35
+ options.body = JSON.stringify(requestObject.body)
37
36
 
38
- if (
39
- requestObject.headers &&
40
- requestObject.headers['content-type'] &&
41
- requestObject.headers['content-type'] !== 'application/json'
42
- ) {
43
- options.json = false
44
- } else {
45
- options.json = true
37
+ if (options.headers['content-type'] !== 'application/json') {
38
+ options.headers['content-type'] = 'application/json'
39
+ }
46
40
  }
47
41
 
42
+ // if (
43
+ // requestObject.headers &&
44
+ // requestObject.headers['content-type'] &&
45
+ // requestObject.headers['content-type'] !== 'application/json'
46
+ // ) {
47
+ // options.json = false
48
+ // } else {
49
+ // options.json = true
50
+ // }
51
+
48
52
  debug(`Querying URI: ${decodeURIComponent(options.uri)}`)
49
53
 
50
54
  const response = await fetch(options.uri, options).catch(err => {
@@ -14,6 +14,8 @@ module.exports = function (CaruutoClient) {
14
14
  uri: this._buildURL()
15
15
  }
16
16
 
17
+ this._setHeader('content-type', 'application/json')
18
+
17
19
  // if (this._isValidHook()) {
18
20
  // requestPayload.body = data
19
21
 
@@ -177,6 +179,8 @@ module.exports = function (CaruutoClient) {
177
179
  uri: this._buildURL()
178
180
  }
179
181
 
182
+ this._setHeader('content-type', 'application/json')
183
+
180
184
  // if (this._isValidHook()) {
181
185
  // requestPayload.body = update
182
186
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caruuto/caruuto-js",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A high-level library for interacting with Caruuto",
5
5
  "exports": "./index.js",
6
6
  "scripts": {