node-mock-http

<!-- automd:badges color=yellow -->

MIT 11 个版本
安装
npm install node-mock-http
yarn add node-mock-http
pnpm add node-mock-http
bun add node-mock-http
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

版本列表
1.0.5 2026-07-28
1.0.4 2025-12-04
1.0.3 2025-09-04
1.0.2 2025-07-30
1.0.1 2025-06-25
1.0.0 2025-02-05
0.1.4 2025-02-05
0.1.2 2025-02-05
0.1.1 2025-02-05
0.1.0 2025-02-05
0.0.0 2025-02-05