mirror of
https://github.com/honojs/hono.git
synced 2024-12-01 10:51:01 +00:00
18 lines
533 B
JavaScript
18 lines
533 B
JavaScript
|
const fetch = require('node-fetch')
|
||
|
const { Hono, Middleware } = require('./hono')
|
||
|
|
||
|
describe('Builtin Middleware', () => {
|
||
|
const app = new Hono()
|
||
|
|
||
|
app.use('*', Middleware.poweredBy)
|
||
|
app.get('/', () => new fetch.Response('root'))
|
||
|
|
||
|
it('Builtin Powered By Middleware', async () => {
|
||
|
let req = new fetch.Request('https://example.com/')
|
||
|
let res = await app.dispatch(req, new fetch.Response())
|
||
|
expect(res).not.toBeNull()
|
||
|
expect(res.status).toBe(200)
|
||
|
expect(res.headers.get('X-Powered-By')).toBe('Hono')
|
||
|
})
|
||
|
})
|