ctimmerm/axios-mock-adapter

Compatibility Issue with axios@v1

mpyw opened this issue · 2 comments

mpyw commented

🤮 Fix axios and axios-mock-adapter compatibility issue on tests 🤮 by mpyw · Pull Request #48 · mpyw/axios-case-converter

The two critical problems are:

  • The value returned from axios-mock-adapter mock definitions must be an AxiosHeaders object, otherwise the instance reference will be changed.
  • axios does not expose AxiosHeaders constructor.

While not a bug, axios@v1 still has a problem for testability.

Returning response headers on mock response definition won't work anymore in some cases. The dirty hack will be needed, otherwise we need to make it exposed in axios core.

I think this got fixed. Please use the newest version.