floppy-disk 2.15.0 → 2.15.1-beta.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/esm/utils/fetcher.js +2 -1
- package/lib/utils/fetcher.js +2 -1
- package/package.json +1 -1
package/esm/utils/fetcher.js
CHANGED
|
@@ -45,7 +45,8 @@ export const fetcher = (options) => async (...args) => {
|
|
|
45
45
|
const { url: finalUrl, ...finalOptions } = interceptedOptions;
|
|
46
46
|
const res = await fetch(finalUrl, finalOptions);
|
|
47
47
|
const contentType = res.headers.get('content-type');
|
|
48
|
-
|
|
48
|
+
const isJsonFile = /\.json(\?.+)?$/.test(finalUrl);
|
|
49
|
+
if (contentType?.includes('application/json') || isJsonFile) {
|
|
49
50
|
let resJson = await res.json();
|
|
50
51
|
if (query) {
|
|
51
52
|
if (resJson.errors) {
|
package/lib/utils/fetcher.js
CHANGED
|
@@ -48,7 +48,8 @@ const fetcher = (options) => async (...args) => {
|
|
|
48
48
|
const { url: finalUrl, ...finalOptions } = interceptedOptions;
|
|
49
49
|
const res = await fetch(finalUrl, finalOptions);
|
|
50
50
|
const contentType = res.headers.get('content-type');
|
|
51
|
-
|
|
51
|
+
const isJsonFile = /\.json(\?.+)?$/.test(finalUrl);
|
|
52
|
+
if (contentType?.includes('application/json') || isJsonFile) {
|
|
52
53
|
let resJson = await res.json();
|
|
53
54
|
if (query) {
|
|
54
55
|
if (resJson.errors) {
|