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.

Feature request: fetch based adapter

See original GitHub issue

I didn’t see an issue for this (opened or closed), but if this is a duplicate just close it 😸 .

Are there any plans for a fetch based adapter for axios? I thought I’d check and see if this has been discussed, and if not, if you all would be open to a feature request (or I’m happy to work on it and PR it).

Reasons for adding a fetch adapter are basically for the same reasons you’d use fetch:

  • Support for service workers
  • Integration with Cache API
  • natively promise based, so axios can become a thinner library
  • response streaming
  • probably more that I’m not even thinking of right now

Reasons you’d still want axios wrapping fetch for you (because some people feel like you don’t need a lib over fetch):

  • fetch is low level. Using plain fetch in an app that is 99% GET/PUT/POST against a JSON API means lots of duplicate boilerplate code which axios can abstract
  • request/response interceptors
  • probably more that I’m not even thinking of right now 😄

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:118
  • Comments:43 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
jc275commented, Jan 1, 2018

Agreed. This looks like a dealbreaker for using Axios in PWAs, because the serviceworker can only intercept and cache http requests sent via the fetch api.

Discussed in https://github.com/axios/axios/issues/484

12reactions
sgammoncommented, Apr 12, 2020

this is embarrassing and sad

Read more comments on GitHub >

github_iconTop Results From Across the Web

fetch() - Web APIs | MDN
The global fetch() method starts the process of fetching a resource from the network, returning a promise which is fulfilled once the response...
Read more >
Axios vs. fetch(): Which is best for making HTTP requests?
The fetch() API is perfectly capable of reproducing the key features of Axios, and it has the added advantage of being readily available...
Read more >
axios-fetch-adapter - npm Package Health Analysis - Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix advice.
Read more >
Adapter - 4.7 - Ember API Documentation
An adapter is an object that receives requests from a store and translates ... Typically the adapter is not invoked directly instead its...
Read more >
DataHub Feature Requests
Vote or request new DataHub Feature Requests features. Subscribe to get updates about new features from DataHub Feature Requests.
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