@hapi/hapi
Advanced tools
Comparing version 20.1.3 to 20.1.4
@@ -58,6 +58,7 @@ 'use strict'; | ||
this._payload = null; // Readable stream | ||
this._error = null; // The boom object when created from an error (used for logging) | ||
this._error = options.error || null; // The boom object when created from an error (used for logging) | ||
this._contentType = null; // Used if no explicit content-type is set and type is known | ||
this._takeover = false; | ||
this._statusCode = false; // true when code() called | ||
this._state = this._error ? 'prepare' : 'init'; // One of 'init', 'prepare', 'marshall', 'close' | ||
@@ -499,2 +500,6 @@ this._processors = { | ||
Hoek.assert(this._state === 'init'); | ||
this._state = 'prepare'; | ||
this._passThrough(); | ||
@@ -563,6 +568,10 @@ | ||
let source = this.source; | ||
Hoek.assert(this._state === 'prepare'); | ||
this._state = 'marshall'; | ||
// Processor marshal | ||
let source = this.source; | ||
if (this._processors.marshal) { | ||
@@ -644,2 +653,8 @@ try { | ||
if (this._state === 'close') { | ||
return; | ||
} | ||
this._state = 'close'; | ||
if (this._processors.close) { | ||
@@ -646,0 +661,0 @@ try { |
@@ -104,3 +104,3 @@ 'use strict'; | ||
response = request._core.Response.wrap(response, request); | ||
if (!response.isBoom) { | ||
if (!response.isBoom && response._state === 'init') { | ||
response = await response._prepare(); | ||
@@ -107,0 +107,0 @@ } |
@@ -41,3 +41,5 @@ 'use strict'; | ||
for (const func of response.request._route._marshalCycle) { | ||
await func(response); | ||
if (response._state !== 'close') { | ||
await func(response); | ||
} | ||
} | ||
@@ -76,4 +78,3 @@ }; | ||
const error = boom.output; | ||
const response = new request._core.Response(error.payload, request); | ||
response._error = boom; | ||
const response = new request._core.Response(error.payload, request, { error: boom }); | ||
response.code(error.statusCode); | ||
@@ -80,0 +81,0 @@ response.headers = Hoek.clone(error.headers); // Prevent source from being modified |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://hapi.dev", | ||
"version": "20.1.3", | ||
"version": "20.1.4", | ||
"repository": "git://github.com/hapijs/hapi", | ||
@@ -8,0 +8,0 @@ "main": "lib/index.js", |
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
182986
4600