Back to Explore

mswjs/interceptors

GitHub
6 updates · last 90 days1 watchersOpen source

Last release: 3 weeks ago

@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

  • The mswjs/interceptors repo appears actively maintained, with the latest upstream push on 2026-05-27 and multiple recent version updates (v0.41.7 to v0.41.9) fixing issues and adjusting implementation details.
  • Update cadence looks fairly steady, roughly every 1 to 2 weeks in this recent window (2026-04-29, 2026-05-01, 2026-05-11), suggesting ongoing development rather than maintenance mode.

AI summary generated Today

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v0.41.9

    3 weeks ago

    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

    1 month ago

    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

    1 month ago

    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

    1 month ago

    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

    1 month ago

    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

    1 month ago

    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.

    Features
  • v0.41.3

    3 months ago

    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

    4 months ago

    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

    4 months ago

    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.

    Breaking
  • v0.41.0

    4 months ago

    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