Skip to content

Commit

Permalink
feat(hono-base): tweaks fetch signature for better compatibility wi…
Browse files Browse the repository at this point in the history
…th `deno serve` (#2661)
  • Loading branch information
usualoma authored May 11, 2024
1 parent e460f02 commit 6db1cc6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions deno_dist/hono-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,12 @@ class Hono<
* `.fetch()` will be entry point of your app.
* @see https://hono.dev/api/hono#fetch
*/
fetch = (request: Request, Env?: E['Bindings'] | {}, executionCtx?: ExecutionContext) => {
return this.dispatch(request, executionCtx, Env, request.method)
fetch: (
request: Request,
Env?: E['Bindings'] | {},
executionCtx?: ExecutionContext
) => Response | Promise<Response> = (request, ...rest) => {
return this.dispatch(request, rest[1], rest[0], request.method)
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/hono-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,12 @@ class Hono<
* `.fetch()` will be entry point of your app.
* @see https://hono.dev/api/hono#fetch
*/
fetch = (request: Request, Env?: E['Bindings'] | {}, executionCtx?: ExecutionContext) => {
return this.dispatch(request, executionCtx, Env, request.method)
fetch: (
request: Request,
Env?: E['Bindings'] | {},
executionCtx?: ExecutionContext
) => Response | Promise<Response> = (request, ...rest) => {
return this.dispatch(request, rest[1], rest[0], request.method)
}

/**
Expand Down

0 comments on commit 6db1cc6

Please sign in to comment.