Skip to content
Myr

feat: allow the type of app.request (#1444)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* feat: allow the type of app.request * typo

authored by hagishi · committed by GitHub · parent f521d30 · Browse files · 5 files+18 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+18 added−4 removed

  • tests:+10 added−0 removed
  • other:+8 added−4 removed

5 files+18 added−4 removed

modified:deno_dist/client/types.ts+3 added-1 removed
modified:deno_dist/hono-base.ts+1 added-1 removed
373 unmodified lines
374 return this.dispatch(request, executionCtx, Env, request.method)375 }376377 request = (378 input: Request | string | URL,378 input: RequestInfo | URL,379 requestInit?: RequestInit,380 Env?: E['Bindings'] | {},381 executionCtx?: ExecutionContext382 ) => {
22 unmodified lines
modified:src/client/client.test.ts+10 added
468 unmodified lines
469 expect(res.ok).toBe(true)470 expect(res).toEqual(returnValue)471 })472})473474describe('Use custom fetch (app.request) method', () => {475 it('Should return Response from app request method', async () => {476 const app = new Hono().get('/search', (c) => c.jsonT({ ok: true }))477 type AppType = typeof app478 const client = hc<AppType>('', { fetch: app.request })479 const res = await client.search.$get()480 expect(res.ok).toBe(true)481 })482})
modified:src/client/types.ts+3 added-1 removed
modified:src/hono-base.ts+1 added-1 removed
373 unmodified lines
374 return this.dispatch(request, executionCtx, Env, request.method)375 }376377 request = (378 input: Request | string | URL,378 input: RequestInfo | URL,379 requestInit?: RequestInit,380 Env?: E['Bindings'] | {},381 executionCtx?: ExecutionContext382 ) => {
22 unmodified lines