ctimmerm / axios-mock-adapter

Axios adapter that allows to easily mock requests
MIT License
3.46k stars 245 forks source link

IE10 Error from versions >= 1.17. #255

Closed chaitu9916 closed 4 years ago

chaitu9916 commented 4 years ago

TypeError: Invalid calling object

Context : Testing with only get request.

axios.get(`/something`, {
    headers: {
      Accept: 'application/json',
      contentType: 'application/json; charset=utf-8',
      dataType: 'json',
    },
  }).then((response) => JSON.parse(response.data.body))
    .catch((error) => {
      console.error(error.response);
    })
ctimmerm commented 4 years ago

It seems from version 1.17 , Axios dependency has been upgraded to 19. This setup is causing the above error in Internet Explorer 10, 11.

This is not the case. axios-mock-adapter only has a peer dependency on axios >= 0.9.0. If you are using axios v0.19 in your project, then that is because you've updated it yourself.

chaitu9916 commented 4 years ago

My bad on the peer dependency, so i have set axios to be 0.18 and axios-mock-adapter to be 1.17 , the above mentioned error is thrown in only IE. Should i create a new issue around this? Any thoughts on what might be causing this?

bewildergeist commented 4 years ago

I have experienced the same Invalid calling object in IE11, resolved it by downgrading to axios-mock-adapter@1.17.0, while still running axios@0.19.2, so the issue clearly seems to be with axios-mock-adapter.

See also #254.