Skip to content

Commit d0836e6

Browse files
docs: fix migration guide signatures and cookie JSDoc
MIGRATION.md: - noContent(event) → noContent() — event arg removed in v2 - redirect(event, location, code) → redirect(location, code) - iterable(event, value) → iterable(value) - getRequestPath → event.url.pathname (not deprecated event.path) - getMethod → event.req.method (not deprecated event.method) - Add deprecation note for event.path, event.method, event.headers, event.node src/utils/cookie.ts: - getChunkedCookie JSDoc example used wrong function name getCookie Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 10bc7ce commit d0836e6

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

MIGRATION.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ If you were previously using methods below, you can replace them with `return` s
5050

5151
Other send utils that are renamed and need explicit `return`:
5252

53-
- `sendNoContent(event)` / `return null`: Migrate to `return noContent(event)`.
54-
- `sendIterable(event, <value>)`: Migrate to `return iterable(event, <value>)`.
53+
- `sendNoContent(event)` / `return null`: Migrate to `return noContent()`.
54+
- `sendIterable(event, <value>)`: Migrate to `return iterable(<value>)`.
5555
- `sendProxy(event, target)`: Migrate to `return proxy(event, target)`.
5656
- `handleCors(event)`: Check return value and early `return` if handled(not `false`).
5757
- `serveStatic(event, content)`: Make sure to add `return` before.
58-
- `sendRedirect(event, location, code)`: Migrate to `return redirect(event, location, code)`.
58+
- `sendRedirect(event, location, code)`: Migrate to `return redirect(location, code)`.
5959

6060
:read-more{to="/guide/basics/response" title="Sending Response"}
6161

@@ -136,8 +136,16 @@ H3 v2 deprecated some legacy and aliased utilities.
136136

137137
- `getHeader` / `getRequestHeader`: Migrate to `event.req.headers.get(name)`.
138138
- `getHeaders` / `getRequestHeaders`: Migrate to `Object.fromEntries(event.req.headers.entries())`.
139-
- `getRequestPath`: Migrate to `event.path` or `event.url`.
140-
- `getMethod`: Migrate to `event.method`.
139+
- `getRequestPath`: Migrate to `event.url.pathname`.
140+
- `getMethod`: Migrate to `event.req.method`.
141+
142+
> [!NOTE]
143+
> The following `H3Event` properties are deprecated in v2 and will be removed in a future version:
144+
>
145+
> - `event.path` → use `event.url.pathname + event.url.search`
146+
> - `event.method` → use `event.req.method`
147+
> - `event.headers` → use `event.req.headers`
148+
> - `event.node` → use `event.runtime.node`
141149
142150
### Response utils
143151

src/utils/cookie.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function deleteCookie(
9797
* @param name Name of the cookie to get
9898
* @returns {*} Value of the cookie (String or undefined)
9999
* ```ts
100-
* const authorization = getCookie(request, 'Session')
100+
* const session = getChunkedCookie(event, 'Session')
101101
* ```
102102
*/
103103
export function getChunkedCookie(event: HTTPEvent, name: string): string | undefined {

0 commit comments

Comments
 (0)