You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
axios-mock-adapter (v2.1.0) has shown brittleness with the axios 0.32.0 upgrade: it accesses config.headers.constructor.name directly, crashing when axios returns null-prototype objects (a security hardening introduced in 0.32.0 to prevent prototype pollution).
A workaround was applied in #12447 (postInstall.js patch + {...config.params} spreads in tests), but this reveals a structural issue: axios-mock-adapter hooks into axios adapter internals and is fragile against upstream changes.
The proposal is to replace it with MSW (Mock Service Worker) (or something alternative) which intercepts requests at the network level (Service Worker in browser, http/https in Node) and is completely agnostic of the HTTP client used (axios, fetch, ky, etc.).
What kind of improvement you want to add? (check one with "x", remove the others)
Minor changes to existing features
Code style update (formatting, local variables)
Refactoring (no functional changes, no api changes)
Build related changes
CI related changes
Other... Please describe:
Other useful information
MSW supports karma/browser test environments via msw/browser + Service Worker
Migration can be done incrementally per test file
Once complete, remove patchAxiosMockAdapter from utility/build/postInstall.js
Description
axios-mock-adapter(v2.1.0) has shown brittleness with the axios0.32.0upgrade: it accessesconfig.headers.constructor.namedirectly, crashing when axios returns null-prototype objects (a security hardening introduced in 0.32.0 to prevent prototype pollution).A workaround was applied in #12447 (
postInstall.jspatch +{...config.params}spreads in tests), but this reveals a structural issue:axios-mock-adapterhooks into axios adapter internals and is fragile against upstream changes.The proposal is to replace it with MSW (Mock Service Worker) (or something alternative) which intercepts requests at the network level (Service Worker in browser,
http/httpsin Node) and is completely agnostic of the HTTP client used (axios,fetch,ky, etc.).What kind of improvement you want to add? (check one with "x", remove the others)
Other useful information
msw/browser+ Service WorkerpatchAxiosMockAdapterfromutility/build/postInstall.js