Skip to content
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

fetchBaseQuery doesn't override 'method' field #3061

Closed
alex-vukov opened this issue Jan 6, 2023 · 4 comments · Fixed by #3062
Closed

fetchBaseQuery doesn't override 'method' field #3061

alex-vukov opened this issue Jan 6, 2023 · 4 comments · Fixed by #3062

Comments

@alex-vukov
Copy link
Contributor

Using fetchBaseQuery it's possible to override the headers and other options for all requests in one place except for the method field. It's hardcoded as GET. Is there a reason for this? I have a use-case where all of my requests use POST so it would be convenient to have it overridden in a single place. It could be changed to fallback to GET by default.

@phryneas
Copy link
Member

phryneas commented Jan 6, 2023

Have you tried it, or are you just assuming this? You should be able to pass any argument that would be passed into fetch directly into fetchBaseQuery, and they should be a default for all usages.

@alex-vukov
Copy link
Contributor Author

I tried it. method passed to fetchBaseQuery is ignored.

@phryneas
Copy link
Member

phryneas commented Jan 6, 2023

Huh, that was indeed an oversight. Could you please test the CodeSandbox CI package build from #3062 and give feedback if that works for you?

@alex-vukov
Copy link
Contributor Author

Nice reaction time :) I tested it and it works correctly with this build! Also it correctly falls back to 'GET' if no method is specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants