Open
Description
Hi,
I've been using RKT Query generator in order to generate the endpoints of my API. Everything is going well except that the response type of my endpoints is sometimes plain text and rtk tries to parse it as json. I've set the responseHanlder to 'content-type'. But it's not working :
const baseQuery: BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError> = fetchBaseQuery({
baseUrl: 'localhost:4000',
responseHandler: 'content-type',
});
export const emptySplitApi = createApi({
baseQuery: baseQuery,
endpoints: () => ({}),
});
I get the error error: SyntaxError: Unexpected token 'e', "eyJhbGciOi"... is not valid JSON
I've also tried something like this, in order to see the function runs, but it doesn't output anything.
const baseQuery: BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError> = fetchBaseQuery({
baseUrl: 'localhost:4000',
responseHandler: (response) => {
console.log(response);
return response.text()
}
});