Custom fetch replacement? #489
-
Hi guys! I've seen a PR and an issue that discuss passing a custom fetch instance but nothing related to axios for now... maybe that mentioned issue/pr could be enhanced to allow even axios instances or other http clients? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey Sebastián, writing your own Transport is straight-forward. The implementation with fetch is just 200 lines of code. Only 80 lines if you don't care about streaming. So creating your own Connect transport that uses axios is definitely a feasible option! Are you aware of axios-fetch? It turns an axios instance into a fetch function. Have not tried it, but this could be another approach once we have a solution for #403. |
Beta Was this translation helpful? Give feedback.
-
Hey Timo thanks for your answer. I wasn't aware of axios-fetch but unfortunately I can't use it because I don't have access to the axios instance, I just have a wrapper on top of it from a dependency 😞 |
Beta Was this translation helpful? Give feedback.
Hey Sebastián, writing your own Transport is straight-forward. The implementation with fetch is just 200 lines of code. Only 80 lines if you don't care about streaming. So creating your own Connect transport that uses axios is definitely a feasible option!
Are you aware of axios-fetch? It turns an axios instance into a fetch function. Have not tried it, but this could be another approach once we have a solution for #403.