make cf ctx optional
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user