Closed marcbachmann closed 1 year ago
argh. the baseURL somehow changes from one version to another. v1.2 removes the baseURL after normalization, v0.17.0 doesn't
If I understand it correctly your fix is to call the (unmocked) axios API (with the current request configuration, and without any transformations) when a passthrough is to be performed. (I'm a bit embarressed that I haven't thought about that as a possible fix when I attempted a fix for my own mock library)
Are there any ramifications?
By stripping all transformations from the "inner call" you counteract one of those ramifications, right? I.e. that the transformations would run once too often.
Does axios do any other things besides transformations before the adapter is called?
What with interceptors? Would for example a LoggingInterceptor
now log two entries for the request when it should only log once?
I still hope for a positive reaction from the axios maintainers regarding a proposal for making the default adapter available.
Are there any ramifications? By stripping all transformations from the "inner call" you counteract one of those ramifications, right? I.e. that the transformations would run once too often.
You're right, the interceptors are probably called twice. We could clone the instance during instantiation. Then interceptors won't get copied.
I think everything else config-based is only handled by the adapter.
I've extended the tests with a counter for the request and response interceptors. This should be good to merge.
@ctimmerm This pr fixes compatibility with axios 1. would you like to review that?
hello @ctimmerm , can this fix be merged? :)
+1 @marco-gagliardi
@ctimmerm feel free to add me as maintainer here and on npm if you don't have the time to maintain this module.
I got access to github & npm and released that change as v1.21.3. https://github.com/ctimmerm/axios-mock-adapter/releases/tag/v1.21.3 https://www.npmjs.com/package/axios-mock-adapter
Somehow the prepublish
script didn't run completely.
The axios-mock-adapter.js
file isn't there. 🤔
Just the minified version:
That shouldn't affect normal operation as src/index.js
is declared as main
in the package.json.
thanks so much! this fix allows me to upgrade axios now. Very appreciated
Fixes https://github.com/ctimmerm/axios-mock-adapter/issues/357