Skip to content

Commit 2efabde

Browse files
arunodaimpronunciable
authored andcommitted
Fix koa-404 issue by adding res.statusCode to 200 (#815)
1 parent c1f2b92 commit 2efabde

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/custom-server-koa/server.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ app.prepare()
2626
this.respond = false
2727
})
2828

29+
server.use(function *(next) {
30+
// Koa doesn't seems to set the default statusCode.
31+
// So, this middleware does that
32+
this.res.statusCode = 200
33+
yield next
34+
})
35+
2936
server.use(router.routes())
3037
server.listen(3000, (err) => {
3138
if (err) throw err

0 commit comments

Comments
 (0)