From 53befa69d8577cfaaa7efd7c5ba9ba1e3c477874 Mon Sep 17 00:00:00 2001 From: Lenz Weber Date: Fri, 8 Jul 2022 19:50:52 +0200 Subject: [PATCH] make `text` the default if a wrong `responseHandler` is specified --- packages/toolkit/src/query/fetchBaseQuery.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/toolkit/src/query/fetchBaseQuery.ts b/packages/toolkit/src/query/fetchBaseQuery.ts index 2cbb0ecf13..8a555852c4 100644 --- a/packages/toolkit/src/query/fetchBaseQuery.ts +++ b/packages/toolkit/src/query/fetchBaseQuery.ts @@ -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 =