Releases: mswjs/interceptors
Releases · mswjs/interceptors
Release list
v0.42.6
v0.42.5
v0.42.5 (2026-09-10)
Bug Fixes
- fetch: prevent hanging on passthrough response stream cancellation (#833) (28a70d0) @kettanaito
- http: free parsers on non-HTTP upgrade (#832) (0ba3fd8) @kettanaito
- net: preserve passthrough writes until the client consumes EOF (#830) (04095ba) @kettanaito
- SocketController: prevent listeners leak on TLS passthrough (#829) (5767309) @kettanaito
v0.42.4
v0.42.4 (2026-09-08)
Bug Fixes
- WebSocket: properly export to bundle
debug(#827) (6612286) @kettanaito - http: handle server-closed keep-alive sockets and detach completed parsers (#826) (3a1ed89) @kettanaito
- http: stop observation on parser errors instead of crashing (#825) (8ba5a03) @kettanaito
- http: proper HTTP/2 negotiation for mocked and passthrough (#824) (133db63) @kettanaito
- WebSocket: prevent infinite loop on passthrough connections (#823) (b6362de) @kettanaito
v0.42.3
v0.42.3 (2026-07-24)
Bug Fixes
- socket: properly handle first bytes when switching socket types (#814) (2a08722) @kettanaito
v0.42.2
v0.42.2 (2026-07-24)
Bug Fixes
- socket: move last resort passthrough to the socket level (#812) (d202082) @kettanaito
- socket: close connection on CONNECT request refusal (#811) (d00cc8a) @kettanaito
v0.42.1
v0.42.0
v0.42.0 (2026-07-22)
- Implements TCP/TLS wrap-based interception (#770) (8a8fe6f) @kettanaito
⚠️ BREAKING CHANGES
- Node.js v22 is the minimal supported version.
getRawRequestutility has been removed. Use theinitiatorreference on request listeners directly./utils/nodeandgetClientRequestBodyStream()has been removed. Use theinitiatorreference directly.file://protocol requests are unsupported withfetchthe same way they aren't supported in Node.js 22 and 24 (improved compliance).- HTTP-to-WebSocket upgrade requests throw with
fetchthe same way they do in Node.js. Other upgrade paths are unaffected and function correctly (http.request,WebSocket,undici).
Features
- Supports Node.js v26.
- Supports
CONNECTrequests (fixes #481, closes #621). - Supports Undici
fetchandrequesteven when they aren't global. - Exposes the request
initiatoron the "request" event listener. Theinitiatorproperty points toClientRequest,XMLHttpRequest, orRequestinstance that initiated the intercepted request. If no instance can be reliably deduced, points to the rawnet.Socketbehind the connection.
Bug fixes
- The library now executes more of the Node.js network that ever before. In fact, it executes the biggest possible amount of Node.js code. We are literally patching before the C++ bindings.
- ClientRequest using sockets is now properly supported.
- Now it doesn't matter how you import
http/https(e.g.import * as httpbroke previously since we cannot patch that). - You can now end requests in the write callbacks. The documented limitation of Interceptors is gone.
- Clients waiting for the
secureConnectbefore writing anything are now properly supported. - TLS connections now correctly emit the
keylogevent on the socket. - Fixes an issue where the automatic
Content-Typeheader added by Undici was not set on mocked responses. socket.address(), as well aslocalAddress,localPort,localFamily,remoteAddress,remotePort, and `remoteFamily, are correctly set for both mocked and bypassed connections.- XMLHttpRequest: Fixes an issue where redirect responses weren't being followed.
- XMLHttpRequest: Fixes an issue where the "progress" event for
request.uploadwasn't dispatched correctly. - XMLHttpRequest:
totalresponse body length is now computed only from thecontent-lengthmocked response header, just like it's done natively. - XMLHttpRequest: The
progressevent is now correctly emitted on the request for chunked responses. - XMLHttpRequest (JSDOM): Correctly performs the
OPTIONSpreflight request based on the JSDOM implementation (previously, preflight triggered for requests that shouldn't trigger it). - XMLHttpRequest: Implements mock response handling in accordance to the WHATWG XMLHttpRequest specification to improve browser compliance.
v0.41.9
v0.41.9 (2026-05-11)
Bug Fixes
- use
Symbol.forfor internal symbols (#789) (b393ded) @kettanaito - fetch: remove
abortlistener to prevent leak (#785) (a89b4e4) @kettanaito
v0.41.8
v0.41.8 (2026-05-01)
Bug Fixes
- support patching non-configurable writable properties (#780) (39372f7) @kettanaito
v0.41.7
v0.41.7 (2026-04-29)
Bug Fixes
- FetchResponse: preserve custom
statusandurlafter cloning (#778) (c1a4ba9) @kettanaito - fetch: sanitize header tuples to fix Node.js 24 compatibility (#766) (fa0f1ee) @KrantiPonala @kettanaito