Socket
Socket
Sign inDemoInstall

@hapi/hapi

Package Overview
Dependencies
Maintainers
6
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hapi/hapi - npm Package Compare versions

Comparing version 20.2.0 to 20.2.1

1

lib/core.js

@@ -655,2 +655,3 @@ 'use strict';

let settings = Hoek.clone(options, { shallow: ['cache', 'listener', 'routes.bind'] });
settings.app = settings.app || {};
settings.routes = Config.enable(settings.routes);

@@ -657,0 +658,0 @@ settings = Config.apply('server', settings);

19

lib/request.js

@@ -366,5 +366,3 @@ 'use strict';

for (const func of this._route._cycle) {
if (this._isReplied ||
!this._eventContext.request) {
if (this._isReplied) {
return;

@@ -437,2 +435,6 @@ }

if (exit) { // Can be a valid response or error (if returned from an ext, already handled because this.response is also set)
this._setResponse(this._core.Response.wrap(exit, this)); // Wrap to ensure any object thrown is always a valid Boom or Response object
}
if (!this._eventContext.request) {

@@ -443,6 +445,2 @@ this._finalize();

if (exit) { // Can be a valid response or error (if returned from an ext, already handled because this.response is also set)
this._setResponse(this._core.Response.wrap(exit, this)); // Wrap to ensure any object thrown is always a valid Boom or Response object
}
if (typeof this.response === 'symbol') { // close or abandon

@@ -731,4 +729,9 @@ this._abort();

if (event === 'abort') {
request._setResponse(new Boom.Boom('Request aborted', { statusCode: request.route.settings.response.disconnectStatusCode }));
// Calling _reply() means that the abort is applied immediately, unless the response has already
// called _reply(), in which case this call is ignored and the transmit logic is responsible for
// handling the abort.
request._reply(new Boom.Boom('Request aborted', { statusCode: request.route.settings.response.disconnectStatusCode, data: request.response }));
if (request._events) {

@@ -735,0 +738,0 @@ request._events.emit('disconnect');

@@ -352,13 +352,9 @@ 'use strict';

if (custom.error) {
throw custom.error;
}
if (custom.result !== undefined) {
res.result = custom.result;
}
if (custom.statusCode !== undefined) {
res.statusCode = custom.statusCode;
}
if (custom.statusMessage !== undefined) {
res.statusMessage = custom.statusMessage;
}
}

@@ -365,0 +361,0 @@

@@ -41,5 +41,3 @@ 'use strict';

for (const func of response.request._route._marshalCycle) {
if (response._state !== 'close') {
await func(response);
}
await func(response);
}

@@ -250,5 +248,6 @@ };

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');
// The request has already been aborted - no need to wait or attempt to write.
internals.end(env, 'aborted');
return team.work;

@@ -303,10 +302,15 @@ }

err = err || new Boom.Boom(`Request ${event}`, { statusCode: request.route.settings.response.disconnectStatusCode });
const error = internals.error(request, Boom.boomify(err));
// Update reported response to reflect the error condition
const origResponse = request.response;
const error = err ? Boom.boomify(err) :
new Boom.Boom(`Request ${event}`, { statusCode: request.route.settings.response.disconnectStatusCode, data: origResponse });
request._setResponse(error);
// Make inject throw a disconnect error
if (request.raw.res[Config.symbol]) {
request.raw.res[Config.symbol].statusCode = error.statusCode;
request.raw.res[Config.symbol].statusMessage = error.source.error;
request.raw.res[Config.symbol].result = error.source; // Force injected response to error
request.raw.res[Config.symbol].error = event ? error :
new Boom.Boom(`Response error`, { statusCode: request.route.settings.response.disconnectStatusCode, data: origResponse });
}

@@ -313,0 +317,0 @@

@@ -5,3 +5,3 @@ {

"homepage": "https://hapi.dev",
"version": "20.2.0",
"version": "20.2.1",
"repository": "git://github.com/hapijs/hapi",

@@ -8,0 +8,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc