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

Node v18+ Fetch #81

Open
moll opened this issue Aug 26, 2024 · 0 comments
Open

Node v18+ Fetch #81

moll opened this issue Aug 26, 2024 · 0 comments

Comments

@moll
Copy link
Owner

moll commented Aug 26, 2024

While Node v17 introduced the Fetch API from browsers, Node v18 made it non-experimental. Mitm.js's low-level implementation already hooks into the TCP connection the Fetch implementation does, but doesn't trigger request on Mitm's instance. For access to the HTTP request, Mitm.js hooked into ClientRequest. With Fetch, it'd need to hook somewhere else.

Alternatively Mitm.js could run Node.js's HTTP server/parser on the TCP connection, but we wouldn't know which connection is meant to be mocked as an HTTP connection and which as not. If we could get that info from the programmer, that'd be a breaking change. Better support Fetch with the current Mitm.js API and look into more flexibility in the future.

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