Don't send if headers have already been sent
This commit is contained in:
parent
5522c5649a
commit
dda7bacca7
@ -16,13 +16,16 @@ Common.prototype.notReady = function (err, res, p) {
|
|||||||
Common.prototype.handleErrors = function (err, res) {
|
Common.prototype.handleErrors = function (err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.code) {
|
if (err.code) {
|
||||||
res.status(400).send(err.message + '. Code:' + err.code);
|
if (!res.headerSent)
|
||||||
|
res.status(400).send(err.message + '. Code:' + err.code);
|
||||||
} else {
|
} else {
|
||||||
this.log.error(err.stack);
|
this.log.error(err.stack);
|
||||||
res.status(503).send(err.message);
|
if (!res.headerSent)
|
||||||
|
res.status(503).send(err.message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
res.status(404).send('Not found');
|
if (!res.headerSent)
|
||||||
|
res.status(404).send('Not found');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "flosight-api",
|
"name": "flosight-api",
|
||||||
"description": "A Florincoin blockchain REST and web socket API service for Flocore Node.",
|
"description": "A Florincoin blockchain REST and web socket API service for Flocore Node.",
|
||||||
"version": "5.0.0-beta.68",
|
"version": "5.0.0-beta.69",
|
||||||
"repository": "git://github.com/bitpay/flosight-api.git",
|
"repository": "git://github.com/bitpay/flosight-api.git",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/bitpay/flosight-api/issues"
|
"url": "https://github.com/bitpay/flosight-api/issues"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user