Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support raw net.connection #707

Open
kettanaito opened this issue Feb 11, 2025 · 0 comments
Open

Support raw net.connection #707

kettanaito opened this issue Feb 11, 2025 · 0 comments

Comments

@kettanaito
Copy link
Member

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant