@aeriajs/common 0.0.65 → 0.0.66
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/http.js +3 -0
- package/dist/http.mjs +3 -0
- package/package.json +1 -1
package/dist/http.js
CHANGED
|
@@ -22,6 +22,9 @@ exports.defaultRequestTransformer = defaultRequestTransformer;
|
|
|
22
22
|
const defaultResponseTransformer = async (response) => {
|
|
23
23
|
const result = response;
|
|
24
24
|
result.data = await response.text();
|
|
25
|
+
if (response.headers.get('content-type')?.startsWith('application/json')) {
|
|
26
|
+
result.data = JSON.parse(result.data);
|
|
27
|
+
}
|
|
25
28
|
return result;
|
|
26
29
|
};
|
|
27
30
|
exports.defaultResponseTransformer = defaultResponseTransformer;
|
package/dist/http.mjs
CHANGED
|
@@ -16,6 +16,9 @@ export const defaultRequestTransformer = async (url, payload, params) => {
|
|
|
16
16
|
export const defaultResponseTransformer = async (response) => {
|
|
17
17
|
const result = response;
|
|
18
18
|
result.data = await response.text();
|
|
19
|
+
if (response.headers.get("content-type")?.startsWith("application/json")) {
|
|
20
|
+
result.data = JSON.parse(result.data);
|
|
21
|
+
}
|
|
19
22
|
return result;
|
|
20
23
|
};
|
|
21
24
|
export const request = async (url, payload, config) => {
|