Prevent exception when headers are already sent
This commit is contained in:
parent
3f9f1bceb6
commit
848347f193
|
@ -18,7 +18,10 @@ function apiFailMiddleware (req: express.Request, res: express.Response, next: e
|
|||
})
|
||||
|
||||
res.status(status)
|
||||
res.setHeader('Content-Type', 'application/problem+json')
|
||||
|
||||
if (!res.headersSent) {
|
||||
res.setHeader('Content-Type', 'application/problem+json')
|
||||
}
|
||||
|
||||
const json = new ProblemDocument({
|
||||
status,
|
||||
|
|
Loading…
Reference in New Issue