We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 21e217d + feeb2db commit 71808f2Copy full SHA for 71808f2
.changeset/young-taxis-stare.md
@@ -0,0 +1,5 @@
1
+---
2
+"ember-resources": minor
3
4
+
5
+RemoteData now checks the response's Content-Type header to decide whether to convert to JSON or Text
ember-resources/src/util/remote-data.ts
@@ -125,7 +125,11 @@ export function remoteData<T = unknown>(
125
.then((response) => {
126
state.status = response.status;
127
128
- return response.json();
+ if (response.headers.get('Content-Type')?.includes('json')) {
129
+ return response.json();
130
+ }
131
132
+ return response.text();
133
})
134
.then((data) => {
135
state.isResolved = true;
0 commit comments