-
-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
- msw/node unable to intercept requests from fetch in undici msw#2165
- Unable to intercept octokit request using msw v2. msw#2409
Since https://github.com/mswjs/interceptors/releases/tag/v0.32.0, we now technically can implement a net.Socket
interceptor that would allow us to intercept ClientRequest
but also any agents using sockets directly, like Undici.
This task would involve:
- Implementing the
net.Socket
interceptor interface. - Refactoring ClientRequest (and potentially XHR) interceptors to rely on the Socket interceptor. These higher level interceptors would only concern themselves with parsing the socket packets and deciding whether a particular connection should be intercepted, then controlling it.
- Design some sort of manager that would "lock" socket instances behind certain interceptors. This is to avoid issues when a single request can be handled by multiple interceptors (see Deprecate "X-Request-Id" in favor of another request deduplication algorithm #378). Once we bring the interception to the socket level, all requests will be covered by that interceptor and subsequent higher interceptors that extend it.
Metadata
Metadata
Assignees
Labels
No labels