parent
27d8874780
commit
10dd016415
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@hono/hello': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
new message
|
|
@ -24,7 +24,10 @@
|
||||||
"url": "https://github.com/honojs/middleware.git"
|
"url": "https://github.com/honojs/middleware.git"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/honojs/middleware",
|
"homepage": "https://github.com/honojs/middleware",
|
||||||
"dependencies": {
|
"peerDependencies": {
|
||||||
|
"hono": "^2.6.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
"hono": "^2.6.2"
|
"hono": "^2.6.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ describe('Hello middleware', () => {
|
||||||
const res = await app.request('http://localhost/hello/foo')
|
const res = await app.request('http://localhost/hello/foo')
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
expect(res.status).toBe(200)
|
expect(res.status).toBe(200)
|
||||||
expect(res.headers.get('X-Message')).toBe('Hello')
|
expect(res.headers.get('X-Message')).toBe('Hello!')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should be X', async () => {
|
it('Should be X', async () => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Handler } from 'hono'
|
import type { Handler } from 'hono'
|
||||||
|
|
||||||
export const hello = (message: string = 'Hello'): Handler => {
|
export const hello = (message: string = 'Hello!'): Handler => {
|
||||||
return async (c, next) => {
|
return async (c, next) => {
|
||||||
await next()
|
await next()
|
||||||
c.res.headers.append('X-Message', message)
|
c.res.headers.append('X-Message', message)
|
||||||
|
|
Loading…
Reference in New Issue