Skip to content

Commit

Permalink
make text the default if a wrong responseHandler is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Jul 8, 2022
1 parent c226444 commit 53befa6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/toolkit/src/query/fetchBaseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,12 @@ const handleResponse = async (
responseHandler = isJsonContentType(response.headers) ? 'json' : 'text'
}

if (responseHandler === 'text') {
return response.text()
}

if (responseHandler === 'json') {
const text = await response.text()
return text.length ? JSON.parse(text) : null
}

return responseHandler
return response.text()
}

export type FetchBaseQueryError =
Expand Down

0 comments on commit 53befa6

Please sign in to comment.