Skip to content
Myr

fix(route): fix `app.route()` matter (#246)

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 15bd8ec · Browse files · 2 files+9 added−0 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+9 added−0 removed

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

2 files+9 added−0 removed

modified:src/hono.test.ts+8 added
584 unmodified lines
585 c.res.headers.append('x-custom-a', 'a')586 })587 app.route('/api', api)588589 app.get('/foo', (c) => c.text('bar'))590591 middleware.use('*', async (c, next) => {592 await next()593 c.res.headers.append('x-custom-b', 'b')594 })
33 unmodified lines
628 const res = await app.request('http://localhost/api/posts/123')629 expect(res.status).toBe(200)630 expect(await res.text()).toBe('GET 123')631 })632633 test('GET /foo', async () => {634 const res = await app.request('http://localhost/foo')635 expect(res.status).toBe(200)636 expect(await res.text()).toBe('bar')637 })638 })639640 describe('Chaining', () => {641 const app = new Hono()
143 unmodified lines
modified:src/hono.ts+1 added
129 unmodified lines
130 if (app) {131 app.routes.map((r) => {132 this.addRoute(r.method, r.path, r.handler)133 })134 this._tempPath = null135 }136137 return this138 }
92 unmodified lines