xchainjs-lib icon indicating copy to clipboard operation
xchainjs-lib copied to clipboard

replace axios with the Fetch API

Open dynst opened this issue 8 months ago • 0 comments

  • unpacked size of axios 1.9.0: 2.16 MB
  • unpacked size of node-fetch 2.7.0: 162 kB
  • native support for fetch in Node.js: priceless

Impact on tests

axios-mock-adapter in the Jest unit tests would need replacing by msw.

ky

If instead of fetch the project starts using ky, a light wrapper around fetch that provides fetch's API with added TypeScript generics, hooks.beforeRequest could replace any use of axios.interceptors, or even be used to mock up a custom Response in the unit tests.

dynst avatar May 03 '25 22:05 dynst