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.status(status)
|
||||||
|
|
||||||
|
if (!res.headersSent) {
|
||||||
res.setHeader('Content-Type', 'application/problem+json')
|
res.setHeader('Content-Type', 'application/problem+json')
|
||||||
|
}
|
||||||
|
|
||||||
const json = new ProblemDocument({
|
const json = new ProblemDocument({
|
||||||
status,
|
status,
|
||||||
|
|
Loading…
Reference in New Issue