doc: Rename _req used to req (#2349)
Where other documents use req, they use the name req instead of _req https://github.com/denoland/fresh/blob/b7281792a0a5b2674f659514b1e58116fabd6460/docs/latest/concepts/middleware.md?plain=1#L153
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { FreshContext, MiddlewareHandler } from "$fresh/server.ts";
|
||||
|
||||
// cors middleware
|
||||
async function corsHandler(_req: Request, ctx: FreshContext) {
|
||||
if (_req.method == "OPTIONS") {
|
||||
async function corsHandler(req: Request, ctx: FreshContext) {
|
||||
if (req.method == "OPTIONS") {
|
||||
return new Response(null, {
|
||||
status: 204,
|
||||
});
|
||||
}
|
||||
const origin = _req.headers.get("Origin") || "*";
|
||||
const origin = req.headers.get("Origin") || "*";
|
||||
const resp = await ctx.next();
|
||||
const headers = resp.headers;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user