JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1180314
  • Score
    100M100P100Q195550F
  • License MIT

Package Exports

  • node-mock-http
  • node-mock-http/_polyfill/buffer
  • node-mock-http/_polyfill/events

Readme

node-mock-http

npm version npm downloads

Node.js http.IncomingMessage and http.ServerResponse mocked implementations that allows emulate calling Node.js http handlers. (based on unjs/unenv v1).

Usage

[!NOTE] Documentation is incomplete!

import { fetchNodeRequestHandler } from "node-mock-http";

const nodeHandler = (req, res) => {
  res.end("OK!");
};

const res = await fetchNodeRequestHandler(
  nodeHandler,
  "http://example.com/test",
);

Development

local development
  • Clone this repository
  • Install latest LTS version of Node.js
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Build project in stub mode using pnpm build --stub
  • Run interactive tests using pnpm dev

License

Published under the MIT license. Made by community 💛


🤖 auto updated with automd