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 f3517e0 commit 75eea15
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 @@ -53,16 +53,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 75eea15

Please sign in to comment.