2022-01-12 01:20:16 +01:00
|
|
|
import { Hono } from '../src/hono'
|
2022-02-01 14:15:00 +01:00
|
|
|
import { poweredBy } from '../src/middleware/powered-by/powered-by'
|
2022-01-01 08:22:35 +01:00
|
|
|
|
|
|
|
describe('Builtin Middleware', () => {
|
|
|
|
const app = new Hono()
|
|
|
|
|
2022-02-01 14:15:00 +01:00
|
|
|
app.use('*', poweredBy())
|
2022-01-03 23:02:31 +01:00
|
|
|
app.get('/', () => new Response('root'))
|
2022-01-01 08:22:35 +01:00
|
|
|
|
|
|
|
it('Builtin Powered By Middleware', async () => {
|
2022-01-11 18:14:53 +01:00
|
|
|
const req = new Request('http://localhost/')
|
2022-01-06 23:03:54 +01:00
|
|
|
const res = await app.dispatch(req)
|
2022-01-01 08:22:35 +01:00
|
|
|
expect(res).not.toBeNull()
|
|
|
|
expect(res.status).toBe(200)
|
|
|
|
expect(res.headers.get('X-Powered-By')).toBe('Hono')
|
|
|
|
})
|
|
|
|
})
|