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

[Feature request] Pass custom fetch function #32

Open
KaKi87 opened this issue Aug 7, 2023 · 2 comments
Open

[Feature request] Pass custom fetch function #32

KaKi87 opened this issue Aug 7, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@KaKi87
Copy link

KaKi87 commented Aug 7, 2023

Hello,

It would be nice to be able to pass a specific fetch function to wrap with ofetch, so that it could be used in peculiar environments such as SvelteKit's SSR load function.

Thanks

@dpilafian dpilafian added the enhancement New feature or request label Aug 8, 2023
@dpilafian
Copy link
Member

Potentially relevant SO answer:

Setting a global header with ofetch in nuxt 3
https://stackoverflow.com/a/75605263

@KaKi87
Copy link
Author

KaKi87 commented Aug 8, 2023

No, the answer you attached is about making the wrapper (whether it is fetch-json or ofetch) globally available, which isn't what I'm asking for.

What I'm asking for is the ability to pass a fetch function as parameter to fetchJson so that it uses the specified one instead of window.fetch.

Thanks

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

No branches or pull requests

2 participants