@faasjs/request 1.3.2 → 1.4.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/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -168,7 +168,7 @@ async function request(url$1, options = { headers: {} }) {
|
|
|
168
168
|
response.statusMessage = res.statusMessage;
|
|
169
169
|
response.headers = res.headers;
|
|
170
170
|
response.body = data;
|
|
171
|
-
if (response.body && response.headers["content-type"] && response.headers["content-type"].includes("application/json"))
|
|
171
|
+
if (response.body && response.headers["content-type"] && response.headers["content-type"].includes("application/json") && typeof response.body === "string" && (response.body.startsWith("{") || response.body.startsWith("[")))
|
|
172
172
|
try {
|
|
173
173
|
response.body = (options.parse || JSON.parse)(response.body);
|
|
174
174
|
logger$1.debug("response.parse JSON");
|
package/dist/index.mjs
CHANGED
|
@@ -161,7 +161,7 @@ async function request(url, options = { headers: {} }) {
|
|
|
161
161
|
response.statusMessage = res.statusMessage;
|
|
162
162
|
response.headers = res.headers;
|
|
163
163
|
response.body = data;
|
|
164
|
-
if (response.body && response.headers["content-type"] && response.headers["content-type"].includes("application/json"))
|
|
164
|
+
if (response.body && response.headers["content-type"] && response.headers["content-type"].includes("application/json") && typeof response.body === "string" && (response.body.startsWith("{") || response.body.startsWith("[")))
|
|
165
165
|
try {
|
|
166
166
|
response.body = (options.parse || JSON.parse)(response.body);
|
|
167
167
|
logger.debug("response.parse JSON");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/request",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@faasjs/logger": "1.
|
|
24
|
+
"@faasjs/logger": "1.4.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@faasjs/logger": "1.
|
|
27
|
+
"@faasjs/logger": "1.4.1"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
30
|
"npm": ">=9.0.0",
|