-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
RTK incorrectly parses non-json response types. #2440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can use https://redux-toolkit.js.org/rtk-query/api/fetchBaseQuery#parsing-a-response |
If I understand correctly, I'd have to implement that custom handler for every endpoint of my API. Is there a way I can globally handle that? (context: My API always returns plain text instead of JSON) |
@alexandernst You can pass |
@phryneas Indeed, I saw that after replying to this thread. Actually, I replied you here: #2363 (comment) |
An example of this using generated code with
Actually is there a way to just extend the query defined in the generated file? |
I have an open api spec that I've generated a RTK reducer for:
The response is type is a string with content-type of
text-html
(yuck), but on successful API request, RTK Query fails with an error:Is there someway to properly get RTK to treat data as just a string instead of trying to parse the result as JSON?
The text was updated successfully, but these errors were encountered: