@hapi/hapi
Advanced tools
Comparing version 20.1.0 to 20.1.1
@@ -27,2 +27,3 @@ 'use strict'; | ||
this._allowInternals = !!options.allowInternals; | ||
this._closed = false; // true once the response has closed (esp. early) and will not emit any more events | ||
this._core = server._core; | ||
@@ -315,2 +316,3 @@ this._entity = null; // Entity information set via h.entity() | ||
this.raw.req.on('aborted', internals.event.bind(this.raw.req, this._eventContext, 'abort')); | ||
this.raw.res.once('close', internals.closed.bind(this.raw.res, this)); | ||
} | ||
@@ -692,2 +694,7 @@ | ||
internals.closed = function (request) { | ||
request._closed = true; | ||
}; | ||
internals.event = function ({ request }, event, err) { | ||
@@ -694,0 +701,0 @@ |
@@ -247,2 +247,9 @@ 'use strict'; | ||
if (request._closed) { | ||
// No more events will be fired, so we proactively close-up shop | ||
request.raw.res.end(); // Ensure res is finished so internals.end() doesn't think we're responding | ||
internals.end(env, 'close'); | ||
return team.work; | ||
} | ||
const aborted = internals.end.bind(null, env, 'aborted'); | ||
@@ -249,0 +256,0 @@ const close = internals.end.bind(null, env, 'close'); |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://hapi.dev", | ||
"version": "20.1.0", | ||
"version": "20.1.1", | ||
"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
182385
4588