feat(fetch): add fetch, Request, Response env config variables for the adapter;#7003
Conversation
713067e to
21da39e
Compare
21da39e to
0211273
Compare
|
OMG this is awesome. However, what about the issue with Thanks |
|
@KaKi87 Well, I'm not familiar with this SSR framework. What do you mean? Load functions? It seems I don't really understand how Axios can be used in this concept. But in any case, the PR satisfies the feature request "Allow passing custom fetch function". If SvelteKit concepts are not compatible with fetch one, that would be another issue. |
Yes.
Here's an example : https://git.kaki87.net/KaKi87/experiment-bun-sveltekit-go4liftoff/src/commit/afcf8011dd180fab86d104634abc36e6b098addb/src/routes/launches/+page.js#L7 Here's also another example, where I had to switch to another lib that somewhat mimics Axios while not being as good : https://git.kaki87.net/KaKi87/manjaro-packages/src/branch/master/src/routes/+page.js
SvelteKit or not, |
Hmm. Still not clear what the blockers are that prevent us from using Axios there now? It looks like a standard approach to making HTTP requests, nothing special. |
|
|
@KaKi87 Ah, server-side. Did you select the |
It doesn't, as I said, it's because of the https://github.com/axios/axios/blob/v1.x/lib/adapters/fetch.js#L194 |
|
@KaKi87 I see. If their Request class is not tolerant to the relative path too, then you have to wait for the release, and you should be able to set |
|
I actually didn't wait for the release, I tested it from the branch, and the error I provided came directly from that. Using |
Now fetch adapter allows you to set a custom
fetchfunction in theenvconfig, as well asRequest&Responseconstructors. This was done to make the fetch adapter more generic and allow custom environments to configure fetch API globals that are used by Axios.One of the possible applications is using it for Tauri apps, where a custom fetch api is used to bypass CORS restrictions.
Closes #6671