-
-
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
Allow setting the default responseHandler at a higher level #2385
Comments
A PR adding If you are not using TypeScript, it is probably even already possible to pass it into |
Slightly confused re-reading this, but I think this is fixed by #2363 ? |
I take it back. Re-re-reading our own types: I think you can pass |
Short version: it would be nice to be able to specify export const pokemonApi = createApi({
reducerPath: 'pokemonApi',
baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),
responseHandler: 'content-type',
endpoints: (builder) => ({
getPokemonByName: builder.query<Pokemon, string>({
query: (name) => `pokemon/${name}`,
}),
}),
}) Or similar. |
I added a PR for that today - #2823 But it's part of |
Merged into the 1.9 branch |
Because of #2354 (which is addressed in #2363, pending feedback), we have resorted to adding a custom
responseHandler
to each and every endpoint definition.This gets tedious, and it's easy for one of the several developers on our team to miss a case until we run into a run-time
PARSING_ERROR
when we get a"text/plain"
response.It would be very convenient to be able to set the default
responseHandler
across all endpoints in the options tocreateApi
.The text was updated successfully, but these errors were encountered: