Skip to content

Node v18+ Fetch #81

@moll

Description

@moll

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions