feat: new messages (#13)

* feat: new messages

* add changeset
pull/14/head
Yusuke Wada 2022-12-24 21:12:21 +09:00 committed by GitHub
parent 27d8874780
commit 10dd016415
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/hello': patch
---
new message

View File

@ -24,7 +24,10 @@
"url": "https://github.com/honojs/middleware.git"
},
"homepage": "https://github.com/honojs/middleware",
"dependencies": {
"peerDependencies": {
"hono": "^2.6.2"
},
"devDependencies": {
"hono": "^2.6.2"
}
}

View File

@ -14,7 +14,7 @@ describe('Hello middleware', () => {
const res = await app.request('http://localhost/hello/foo')
expect(res).not.toBeNull()
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 () => {

View File

@ -1,6 +1,6 @@
import type { Handler } from 'hono'
export const hello = (message: string = 'Hello'): Handler => {
export const hello = (message: string = 'Hello!'): Handler => {
return async (c, next) => {
await next()
c.res.headers.append('X-Message', message)