Replace Axios with Fetch
See original GitHub issueAxios browserified doesn’t support setting ‘keep-alive’ (the httpsAgent
needed is just a stub), so every new server connection will do SSL negotiation, adding quite some time (~0.25s perhaps) to the response time.
isomorphic-fetch
comes with node and browser support, with polyfills for older browsers.
I can do the PR, just want a go/no-go
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Replace axios with a simple custom fetch wrapper
Axios can do a ton of stuff, but here's a simpler solution that can handle most use cases.
Read more >how to properly replace axios api with fetch api and map over ...
Call res.json() will return a Promise. You need to add a second then block: fetch("https://jsonplaceholder.typicode.com/users") .then((res) ...
Read more >Axios vs. fetch(): Which is best for making HTTP requests?
To send data, fetch() uses the body property for a post request to send data to the endpoint, while Axios uses the data...
Read more >Difference between Fetch and Axios.js for making http requests
Fetch is a two-step process when handling JSON data- first, to make the actual request; second, to call the .json() method on the...
Read more >From Fetch to Axios — A better way to call APIs
Guide on how to rewrite fetch implementations to use axios with a use case example of calling SuperTokens API.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@johansten Go for it!
@tomquisel
It doesn’t look very complicated… I’ll just replace HorizonAxiosClient with the same functionality implemented using Fetch instead. One issue might be that proper timeouts w/ Fetch needs something called an
AbortController
which came into full support later than Fetch itself.