question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Replace Axios with Fetch

See original GitHub issue

Axios 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:open
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
morleyzhicommented, Mar 5, 2019

@johansten Go for it!

0reactions
johanstencommented, Mar 30, 2019

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found