@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.
- package/lib/performFetch.js +14 -10
- package/lib/terminators.js +4 -0
- package/package.json +1 -1
package/lib/performFetch.js
CHANGED
|
@@ -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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 => {
|
package/lib/terminators.js
CHANGED
|
@@ -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
|
|