0

We have a vanilla Javascript application that uses heavily fetch for AJAX requests.

As I need to intercept those requests to put some custom headers and other data, we found out that axios could be a good solution.

As I don't want to modify all the native fetch calls, is there a way to intercept those fetch requests with axios implicitly ?

Parko
  • 1
  • 1
  • 2
    Why can't you just use the `fetch` and modify the headers there? – putvande Mar 16 '19 at 22:03
  • Possible duplicate of https://stackoverflow.com/questions/25335648/how-to-intercept-all-ajax-requests-made-by-different-js-libraries/25335826 – benjarwar Mar 16 '19 at 23:29
  • But also, there are some existing libraries that may help, like https://www.npmjs.com/package/fetch-intercept. – benjarwar Mar 16 '19 at 23:31

0 Answers0