Skip to content

Commit

Permalink
remove string check
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Nov 14, 2023
1 parent 0eab814 commit 21d3735
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions packages/core/src/internal/fetchSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,14 @@ async function* fetchOperation(
} else {
if (contentType === 'text/plain') {
const text = await response.text();
if (text.startsWith('{')) {
try {
results = JSON.parse(text);
if (process.env.NODE_ENV !== 'production') {
console.warn(
`Found response with content-type "text/plain" but it had a valid "application/json" response.`
);
}
} catch (e) {
throw new Error(text);
try {
results = JSON.parse(text);
if (process.env.NODE_ENV !== 'production') {
console.warn(
`Found response with content-type "text/plain" but it had a valid "application/json" response.`
);
}
} else {
} catch (e) {
throw new Error(text);
}
} else {
Expand Down

0 comments on commit 21d3735

Please sign in to comment.