Comparing version 5.0.0 to 6.0.0
@@ -21,2 +21,3 @@ 'use strict'; | ||
verbose: typeof verbose === 'boolean' ? verbose : true, | ||
serializeStack: opts.serializeStack, | ||
bodyStatusCode: opts.bodyStatusCode, | ||
@@ -70,3 +71,2 @@ additionalParams: opts.additionalParams, | ||
if (opts.verbose) { | ||
body.stack = err.stack; | ||
body.expected = err.expected; | ||
@@ -76,2 +76,6 @@ body.debug = err.debug; | ||
if (opts.serializeStack) { | ||
body.stack = err.stack; | ||
} | ||
// Append additional params | ||
@@ -78,0 +82,0 @@ if (opts.additionalParams) { |
{ | ||
"name": "send-data", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "send data through response", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -191,3 +191,3 @@ 'use strict'; | ||
assert.equal(b.message, 'test'); | ||
assert.ok(b.stack); | ||
assert.notok(b.stack); | ||
@@ -198,2 +198,27 @@ assert.end(); | ||
test('serializes stack only when told to do so', function t(assert) { | ||
function requestFoo(assertions) { | ||
var s = makeServer({ | ||
verbose: true, | ||
serializeStack: true | ||
}, function onReq(req, res, o, cb) { | ||
var err = new Error('test'); | ||
err.expected = 'expected'; | ||
err.debug = 'debug'; | ||
cb(err); | ||
}); | ||
hammockRequest(s, { | ||
url: '/foo', | ||
json: true | ||
}, assertions); | ||
} | ||
requestFoo(function onFoo(err, resp) { | ||
var b = resp.body; | ||
assert.ok(b.stack); | ||
assert.end(); | ||
}); | ||
}); | ||
test('send an expected error with verbose', function t(assert) { | ||
@@ -216,3 +241,3 @@ var s = makeServer({ | ||
assert.equal(b.message, 'test'); | ||
assert.ok(b.stack); | ||
assert.notok(b.stack); | ||
@@ -219,0 +244,0 @@ assert.end(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25976
690