Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.on(`error`, (err, _, response) => {
if (response) {
res.writeHead(response.statusCode!, response.headers)
} else {
const message = `Error when trying to proxy request "${req.originalUrl}" to "${proxiedUrl}"`
report.error(message, err)
res.sendStatus(500)
}
})
)