-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve fetchBaseQuery content json verification #2282
Comments
@phryneas any thoughts ? |
I honestly have no idea, all those additional content-types are pretty much out of my knowledge domain since I never had to touch any of them. If it is a valid thing: sure, why not? But are we 100% sure that it is valid for every last one? |
I ran into this same issue also because of using the The iana list of media type shows about 136 media types containing |
My problem is that already the first one on that list ( |
How about matching either The goal with this issue is to try and prevent other developers from encountering an issue where sometimes the body in their endpoint definition has JSON.stringified() applied automatically (where Another approach, if the goal is to prevent applying JSON.stringify() twice, could be to see if the body isJsonifiable, so I've included a different PR with that approach. |
@ShaunDychko @phryneas I ran into this recently with a custom fetch wrapper based around |
#2331 is definitely better with the added flexibility. Since we're here on account of |
Oh, on the question of including |
This is handled in #2331 which I just merged into the 1.9 branch. |
Currently in the docs regarding the body it says:
// fetchBaseQuery automatically adds 'content-type: application/json' to the Headers and calls JSON.stringify(patch)
However it doesn't state that it only "stringifies" if the
content-type
is strictlyapplication/json
, I useapplication/vnd.api+json
for example and it was not very easy to figure what was wrong.My proposal is to check if the content-type contains the json extension, so it will cover all json cases, if no one sees any issues with this proposal I'd be glad to push a PR for it, otherwise we could at least update the docs to avoid any confusion.
The text was updated successfully, but these errors were encountered: