Skip to content

Commit

Permalink
feat: migrate from unenv v1 to node-mock-http (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Feb 5, 2025
1 parent d19ca8a commit 301cb17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/1.guide/4.event.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The main properties of an event are:

### `event.node`

The `event.node` allows you to access the native Node.js request and response. In runtimes other than Node.js/Bun, h3 makes a compatible shim using [unjs/unenv](https://unenv.unjs.io).
The `event.node` allows you to access the native Node.js request and response. In runtimes other than Node.js/Bun, h3 makes a compatible shim using [unjs/node-mock-http](https://github.com/unjs/node-mock-http).

> [!IMPORTANT]
> Try to **avoid** depending on `event.node.*` context as much as you can and instead prefer h3 utils.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
"defu": "^6.1.4",
"destr": "^2.0.3",
"iron-webcrypto": "^1.2.1",
"node-mock-http": "^0.1.0",
"ohash": "^1.1.4",
"radix3": "^1.1.2",
"ufo": "^1.5.4",
"uncrypto": "^0.1.3",
"unenv": "^1.10.0"
"uncrypto": "^0.1.3"
},
"devDependencies": {
"0x": "^5.8.0",
Expand Down
11 changes: 8 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/adapters/plain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IncomingMessage } from "node:http";
import {
IncomingMessage as NodeIncomingMessage,
ServerResponse as NodeServerResponse,
} from "unenv/runtime/node/http/index";
} from "node-mock-http";
import type { App } from "../app";
import type { HTTPMethod } from "../types";
import { createError, isError, sendError } from "../error";
Expand Down

0 comments on commit 301cb17

Please sign in to comment.