We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2fb92ef commit d87d8e5Copy full SHA for d87d8e5
2 files changed
src/app.ts
@@ -21,6 +21,10 @@ export function createApp (): App {
21
22
const val = await layer.handle(req, res)
23
24
+ if (res.writableEnded) {
25
+ break
26
+ }
27
+
28
const type = typeof val
29
if (type === 'string') {
30
send(res, val, MIMES.html)
test/fixture/server.js
@@ -14,6 +14,7 @@ const app = createApp()
14
15
app.use('/api/hello', req => ({ url: req.url }))
16
app.use('/api/express', createExpress())
17
+app.use('/api', (_req, res) => { res.end('API root') })
18
app.use('/', () => 'Hello world!')
19
20
const port = process.env.PORT || 3000
0 commit comments