aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-14 09:34:53 +0200
committerChocobozzz <me@florianbigard.com>2023-04-14 09:34:53 +0200
commit848347f193ca43f098e77b321f6555bd4a143e62 (patch)
tree6cc70c9214f8fb26d233460785547318c3235a16 /server/middlewares
parent3f9f1bceb6195652bfa5a8553461d630f2bf293b (diff)
downloadPeerTube-848347f193ca43f098e77b321f6555bd4a143e62.tar.gz
PeerTube-848347f193ca43f098e77b321f6555bd4a143e62.tar.zst
PeerTube-848347f193ca43f098e77b321f6555bd4a143e62.zip
Prevent exception when headers are already sent
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/error.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/middlewares/error.ts b/server/middlewares/error.ts
index 7b116eb57..540edaeeb 100644
--- a/server/middlewares/error.ts
+++ b/server/middlewares/error.ts
@@ -18,7 +18,10 @@ function apiFailMiddleware (req: express.Request, res: express.Response, next: e
18 }) 18 })
19 19
20 res.status(status) 20 res.status(status)
21 res.setHeader('Content-Type', 'application/problem+json') 21
22 if (!res.headersSent) {
23 res.setHeader('Content-Type', 'application/problem+json')
24 }
22 25
23 const json = new ProblemDocument({ 26 const json = new ProblemDocument({
24 status, 27 status,