Skip to content

Commit 3fd8142

Browse files
committed
update
1 parent 054e568 commit 3fd8142

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

docs/canary/concepts/context.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ Contains the incoming
3939

4040
```ts
4141
app.get("/", (ctx) => {
42-
console.log("Request: ", ctx.req);
42+
console.log("Request: ", ctx.request);
4343
44-
if (ctx.req.headers.has("X-Foo")) {
44+
if (ctx.request.headers.has("X-Foo")) {
4545
// do something
4646
}
4747

src/dev/middlewares/automatic_workspace_folders.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function automaticWorkspaceFolders<T>(root: string): Middleware<T> {
4040
content ??= JSON.stringify({ workspace: { root, uuid } }, undefined, 2);
4141
etag ??= await eTag(content);
4242

43-
const noneMatchValue = ctx.req.headers.get("if-none-match");
43+
const noneMatchValue = ctx.request.headers.get("if-none-match");
4444
if (!ifNoneMatch(noneMatchValue, etag)) {
4545
return new Response(undefined, { status: 304, headers: { etag } });
4646
}

src/middlewares/cors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function cors<State>(options?: CORSOptions<State>): Middleware<State> {
9494
const optsOrigin = opts.origin;
9595

9696
return async (ctx) => {
97-
const requestOrigin = ctx.req.headers.get("origin") || "";
97+
const requestOrigin = ctx.request.headers.get("origin") || "";
9898

9999
let allowOrigin: string | null = null;
100100
if (typeof optsOrigin === "string") {
@@ -115,7 +115,7 @@ export function cors<State>(options?: CORSOptions<State>): Middleware<State> {
115115
vary.add("Origin");
116116
}
117117

118-
if (ctx.req.method === "OPTIONS") {
118+
if (ctx.request.method === "OPTIONS") {
119119
const headers = new Headers();
120120

121121
addHeaderProperties(
@@ -137,7 +137,7 @@ export function cors<State>(options?: CORSOptions<State>): Middleware<State> {
137137

138138
let allowHeaders = opts.allowHeaders;
139139
if (!allowHeaders?.length) {
140-
const reqHeaders = ctx.req.headers.get(
140+
const reqHeaders = ctx.request.headers.get(
141141
"Access-Control-Request-Headers",
142142
);
143143
if (reqHeaders) {

src/middlewares/csrf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function csrf<State>(
7878
};
7979

8080
return async (ctx) => {
81-
const { method, headers } = ctx.req;
81+
const { method, headers } = ctx.request;
8282

8383
// Safe methods
8484
if (method === "GET" || method === "HEAD" || method === "OPTIONS") {

src/render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export async function renderRouteComponent<State>(
135135
info: ctx.info,
136136
isPartial: ctx.isPartial,
137137
params: ctx.params,
138-
req: ctx.req,
138+
req: ctx.request,
139139
state: ctx.state,
140140
url: ctx.url,
141141
};

src/segments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export async function renderRoute<State>(
153153
internals.layouts = [];
154154
}
155155

156-
const method = ctx.req.method as Method;
156+
const method = ctx.request.method as Method;
157157

158158
const handlers = route.handler;
159159
if (handlers === undefined) {

0 commit comments

Comments
 (0)