paraswap/paraswap-sdk

axios limitation < 1.0.0

Closed this issue ยท 2 comments

Hi,

first of all thanks for your awesome work ๐Ÿ‘

I want to use use paraswap-sdk in my project, but my axios lib version is up to date (currently: v1.2.0) and because of that I can't install your SDK. I think it would be bad to downgrade my version of Axios because of Paraswap SDK ๐Ÿ˜Ÿ

image

Thank you for bringing this to our attention.
This should be fixed in the new release, but you may want to downgrade your axios dependency to v1.1.3 because of a regression..

Alternatively you could apply the following workaround:

import _axios from 'axios';
const axiosInst = _axios.create({
  headers: { 'Accept-Encoding': 'identity' },
});

const axios = {
  request: axiosInst.request.bind(axiosInst),
  isAxiosError: _axios.isAxiosError,
};
// use this `axios` when constructing SDK

But this way you would be opting out of response compression.

Thanks for your workaround and quick answer! ๐Ÿ‘