Skip to content

Commit

Permalink
fix: set proper headers for HEAD requests
Browse files Browse the repository at this point in the history
  • Loading branch information
v1rtl committed Jun 10, 2021
1 parent 66338b4 commit 072e75f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion __tests__/core/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ describe('HTTP methods', () => {
const server = app.listen()
const fetch = makeFetch(server)

await fetch('/', { method: 'HEAD' }).expect(204)
await fetch('/', { method: 'HEAD' }).expect(200)
})
it('HEAD request does not work for undefined handlers', async () => {
const app = new App()
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export class App<
type: 'mw',
path: '/'
},
...matched.filter((x) => (x.method ? x.method === req.method : true))
...matched.filter((x) => req.method === 'HEAD' || (x.method ? x.method === req.method : true))
]

if (matched[0] != null) {
Expand Down

0 comments on commit 072e75f

Please sign in to comment.