0
0
mirror of https://github.com/honojs/hono.git synced 2024-12-01 11:51:01 +01:00
hono/test/middleware.test.ts

18 lines
511 B
TypeScript
Raw Normal View History

import { Hono } from '../src/hono'
import { poweredBy } from '../src/middleware/powered-by/powered-by'
2022-01-01 08:22:35 +01:00
describe('Builtin Middleware', () => {
const app = new Hono()
app.use('*', poweredBy())
app.get('/', () => new Response('root'))
2022-01-01 08:22:35 +01:00
it('Builtin Powered By Middleware', async () => {
const req = new Request('http://localhost/')
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')
})
})