-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
responseHandler doesn't work #3087
Comments
Maybe because of the But taking a step back: does the server actually set the correct mime type? |
I've tried without the return, still doesn't output anything. And yes I've checked the server actually sets the mime type (see response headers below)
|
My point was that you had written |
Oh that was a typo here I didn't copy paste that part. "@reduxjs/toolkit": "^1.9.1", |
Hmm. It's hard to tell here - especially given that you do not even provide the original code. Could you maybe create a small reproduction for this, maybe a CodeSandbox? |
Sure, here's the CodeSandbox link :https://codesandbox.io/s/aged-wildflower-10ddzl?file=/package.json |
Hmm, I see. This is a bug - it works on a per-endpoint basis, but not on a global basis. Another instance of the bug fixed in #3062. I will see that I push a fix for this onto that open PR in the next few days. Until then: this works fine on a per-endpoint basis: loremText: build.query<String, void>({
query: () => ({
url: "/?type=all-meat&start-with-lorem=1¶s=1&format=text",
responseHandler: "content-type"
})
}) |
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 :
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.
The text was updated successfully, but these errors were encountered: