diff --git a/lib/hooks/responses/defaults/badRequest.js b/lib/hooks/responses/defaults/badRequest.js index 9f99b13046..a9b5dd2ab3 100644 --- a/lib/hooks/responses/defaults/badRequest.js +++ b/lib/hooks/responses/defaults/badRequest.js @@ -34,7 +34,7 @@ module.exports = function badRequest(data, options) { // Only include errors in response if application environment // is not set to 'production'. In production, we shouldn't // send back any identifying information about errors. - if (sails.config.environment === 'production') { + if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) { data = undefined; } diff --git a/lib/hooks/responses/defaults/forbidden.js b/lib/hooks/responses/defaults/forbidden.js index 16e4d81d6e..17e56e98f2 100644 --- a/lib/hooks/responses/defaults/forbidden.js +++ b/lib/hooks/responses/defaults/forbidden.js @@ -31,7 +31,7 @@ module.exports = function forbidden (data, options) { // Only include errors in response if application environment // is not set to 'production'. In production, we shouldn't // send back any identifying information about errors. - if (sails.config.environment === 'production') { + if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) { data = undefined; } diff --git a/lib/hooks/responses/defaults/notFound.js b/lib/hooks/responses/defaults/notFound.js index d14a200f0b..534cf66dca 100644 --- a/lib/hooks/responses/defaults/notFound.js +++ b/lib/hooks/responses/defaults/notFound.js @@ -36,7 +36,7 @@ module.exports = function notFound (data, options) { // Only include errors in response if application environment // is not set to 'production'. In production, we shouldn't // send back any identifying information about errors. - if (sails.config.environment === 'production') { + if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) { data = undefined; } diff --git a/lib/hooks/responses/defaults/serverError.js b/lib/hooks/responses/defaults/serverError.js index e08b4ceebf..2d73b9b3e9 100644 --- a/lib/hooks/responses/defaults/serverError.js +++ b/lib/hooks/responses/defaults/serverError.js @@ -31,7 +31,7 @@ module.exports = function serverError (data, options) { // Only include errors in response if application environment // is not set to 'production'. In production, we shouldn't // send back any identifying information about errors. - if (sails.config.environment === 'production') { + if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) { data = undefined; }