Skip to content
Myr

fix(compose): fix a bug for colliding async routes (#259)

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

authored by Yusuke Wada · committed by GitHub · parent 14f210a · Browse files · 2 files+21 added−1 removed
This commit

State

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

Diff stats

2 files+21 added−1 removed

  • tests:+20 added−0 removed
  • other:+1 added−1 removed

2 files+21 added−1 removed

modified:src/compose.ts+1 added-1 removed
modified:src/hono.test.ts+20 added
778 unmodified lines
779 }).not.toThrow()780 })781 })782})783784describe('Multiple handler - async', () => {785 describe('handler + handler', () => {786 const app = new Hono()787 app.get('/:type/:id', async (c) => {788 await new Promise((resolve) => setTimeout(resolve, 1))789 return c.text('foo')790 })791 app.get('/posts/:id', async (c) => {792 await new Promise((resolve) => setTimeout(resolve, 1))793 const id = c.req.param('id')794 return c.text(`id is ${id}`)795 })796 it('Should return response from `specialized` route', async () => {797 const res = await app.request('http://localhost/posts/123')798 expect(res.status).toBe(200)799 expect(await res.text()).toBe('id is 123')800 })801 })802})