From 70017d24805497b8fa2a5fc128a0b18f599da7f3 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 3 Sep 2025 12:12:53 +0200 Subject: [PATCH] docs: fix form data page (#3329) Fixes https://github.com/denoland/fresh/issues/3320 --- docs/canary/advanced/forms.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/canary/advanced/forms.md b/docs/canary/advanced/forms.md index e4804700..d329b818 100644 --- a/docs/canary/advanced/forms.md +++ b/docs/canary/advanced/forms.md @@ -23,11 +23,11 @@ This example demonstrates how to handle `application/x-www-form-urlencoded` import { define } from "../utils.ts"; export const handlers = define.handlers({ - async GET(req, ctx) { - return await ctx.render(); + async GET(ctx) { + return { data: {} }; }, - async POST(req, ctx) { - const form = await req.formData(); + async POST(ctx) { + const form = await ctx.req.formData(); const email = form.get("email")?.toString(); // Add email to list. @@ -68,11 +68,11 @@ that this time, we have to explicitly declare the form's encoding to be import { define } from "../utils.ts"; export const handler = define.handlers({ - async GET(req, ctx) { + async GET(ctx) { return { data: { message: null } }; }, - async POST(req, ctx) { - const form = await req.formData(); + async POST(ctx) { + const form = await ctx.req.formData(); const file = form.get("my-file") as File; if (!file) {