Skip to content

Commit 557f85e

Browse files
authored
Merge pull request #1172 from sherry0429/dev
add warn when apiThunk receive not application/json response
2 parents d7d71ac + 0adfaed commit 557f85e

File tree

1 file changed

+7
-1
lines changed
  • dash-renderer/src/actions

1 file changed

+7
-1
lines changed

dash-renderer/src/actions/api.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import {mergeDeepRight} from 'ramda';
1+
import {mergeDeepRight, once} from 'ramda';
22
import {handleAsyncError, getCSRFHeader} from '../actions';
33
import {urlBase} from './utils';
44

5+
/* eslint-disable-next-line no-console */
6+
const logWarningOnce = once(console.warn);
7+
58
function GET(path, fetchConfig) {
69
return fetch(
710
path,
@@ -53,6 +56,9 @@ export default function apiThunk(endpoint, method, store, id, body) {
5356
return json;
5457
});
5558
}
59+
logWarningOnce(
60+
'Response is missing header: content-type: application/json'
61+
);
5662
return dispatch({
5763
type: store,
5864
payload: {

0 commit comments

Comments
 (0)