@mswjs/interceptors is a low-level network interception library for Node.js, supporting interception and normalization of HTTP, XMLHttpRequest, fetch, and WebSocket traffic. It runs arbitrary logic on dispatched requests, converting intercepted requests to Fetch API Request instances and letting you construct Fetch API Response objects for intercepted HTTP requests. It’s useful as a lower-level component for higher-level mocking tools such as Mock Service Worker.
Project status
- Actively maintained: The repository shows recent upstream activity (last push 2026-05-27) and frequent tagged updates through May 2026, indicating ongoing maintenance rather than a dormant state.
- Update cadence: Tags are coming in fairly regularly in 2026 (for example, 0.41.7 on 2026-04-29, 0.41.8 on 2026-05-01, 0.41.9 on 2026-05-11), suggesting an active development cadence, at least in the past 6 to 8 weeks.
AI summary generated
Recent updates
v0.41.9
v0.41.9 primarily fixes a potential memory leak related to fetch abort handling and updates several interceptor internals to use global symbols via Symbol.for. The release notes describe both areas at a high level, but the code diff also contains an additional API-level change in one interceptor class and subtle behavior changes around symbol identity.
v0.41.8
v0.41.8 updates the patching behavior in `PatchesRegistry` to handle properties that are non-configurable but writable. The release notes describe the intent (patching non-configurable writable properties), and the code implements it with descriptor-aware logic and adds targeted tests.
v0.41.7
v0.41.7 includes fixes aimed at Node.js 24 compatibility and correctness of mocked FetchResponse cloning. It preserves custom response status and URL across Response.clone, and sanitizes recorded header tuples to avoid extra internal arguments introduced by newer Node versions.
v0.41.6
v0.41.6 focuses on making fetch response cloning safer inside the interceptors. Instead of calling Response.clone() directly, the code now uses a dedicated FetchResponse.clone() helper to avoid failures when cloning is restricted by the runtime.
v0.41.5
v0.41.5 fixes an issue where the library could not detect configurable global values that are defined on a prototype instead of directly on globalThis. The code change introduces a new global patching mechanism (globalsRegistry) and updates fetch, XMLHttpRequest, and WebSocket interceptors to use it.
v0.41.4
v0.41.4 adds a new `FetchRequest` utility and switches several internal interceptors to construct `FetchRequest` instances instead of using the native `Request` constructor directly. The new `FetchRequest` class adds Node/Undici-compatible handling for non-configurable HTTP methods and request modes, and related prototype adjustments are made to keep raw header recording working.
Featuresv0.41.3
v0.41.3 makes a small change to the WebSocket interceptor override to improve typing. The release notes describe annotating the `readyState` property to use the standard `WebSocket['readyState']` type.
v0.41.2
v0.41.2 adds a new public export, resolveWebSocketUrl, and centralizes its implementation in a dedicated utility module. Internally, the WebSocket override interceptor now imports this shared helper instead of defining its own local copy.
v0.41.1
v0.41.1 is a small WebSocket-focused release. The documented change is a bug fix for resolving relative WebSocket connection URLs. The code diff, however, shows broader WebSocket URL normalization behavior changes (scheme rewriting, relative URL resolution, and stricter validation) that can impact how developers compare or store `WebSocket.url` and related event fields.
Breakingv0.41.0
v0.41.0 introduces a bundling pipeline change to use tsdown. It also includes ClientRequest-related fixes around HTTP parser cleanup and passthrough socket listener removal, plus a documented CJS export behavior change for the /presets/node entry.
BreakingFeatures