1
0

make cf ctx optional

This commit is contained in:
2022-11-28 21:27:25 +01:00
parent 5e18d06dfd
commit 2a064dcb9c

View File

@@ -23,7 +23,7 @@ export interface Route<TEnv> {
export interface RouterContext<TEnv = any> { export interface RouterContext<TEnv = any> {
env: TEnv env: TEnv
req: RouterRequest req: RouterRequest
ctx: ExecutionContext ctx?: ExecutionContext
} }
/** /**
@@ -376,7 +376,7 @@ export class Router<TEnv = any> {
* @param {any} [extend] * @param {any} [extend]
* @returns {Promise<Response>} * @returns {Promise<Response>}
*/ */
public async handle(request: Request, env: TEnv, ctx: ExecutionContext, extend: any = {}): Promise<Response> { public async handle(request: Request, env: TEnv, ctx?: ExecutionContext, extend: any = {}): Promise<Response> {
const req: RouterRequest = { const req: RouterRequest = {
...extend, ...extend,
method: request.method, method: request.method,