New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hapi

Package Overview
Dependencies
Maintainers
1
Versions
295
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi - npm Package Compare versions

Comparing version 13.1.0 to 13.2.0

9

lib/response.js

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

this.variety = null;
this.source = null;
this.app = {};

@@ -45,2 +46,3 @@ this.plugins = {};

this._contentEncoding = null; // Set during transmit
this._contentType = null; // Used if no explicit content-type is set and type is known
this._error = null; // The boom object when created from an error

@@ -82,2 +84,3 @@

this.variety = 'buffer';
this._contentType = 'application/octet-stream';
}

@@ -94,2 +97,8 @@ else if (source instanceof Stream) {

this.source = source;
if (this.variety === 'plain' &&
this.source !== null) {
this._contentType = (typeof this.source === 'string' ? 'text/html' : 'application/json');
}
};

@@ -96,0 +105,0 @@

2

lib/schema.js

@@ -69,3 +69,3 @@ 'use strict';

statuses: Joi.array().items(Joi.number().integer().min(200)).min(1)
}),
}).allow(false),
cors: Joi.object({

@@ -72,0 +72,0 @@ origin: Joi.array().min(1),

@@ -47,3 +47,3 @@ 'use strict';

Cors.headers(response);
internals.content(response);
internals.content(response, false);
internals.security(response);

@@ -145,2 +145,3 @@

internals.content(response, true);
return Auth.response(request, next); // Must be last in case requires access to headers

@@ -384,7 +385,10 @@ });

if (response.headers['cache-control']) {
const request = response.request;
if (response.headers['cache-control'] ||
!request.route.settings.cache) {
return;
}
const request = response.request;
const policy = request._route._cache && (request.route.settings.cache._statuses[response.statusCode] || (response.statusCode === 304 && request.route.settings.cache._statuses['200']));

@@ -433,21 +437,13 @@ if (policy ||

internals.content = function (response) {
internals.content = function (response, postMarshal) {
const type = response.headers['content-type'];
if (!type) {
const charset = (response.settings.charset ? '; charset=' + response.settings.charset : '');
if (typeof response.source === 'string') {
response.type('text/html' + charset);
if (response._contentType) {
const charset = (response.settings.charset && response._contentType !== 'application/octet-stream' ? '; charset=' + response.settings.charset : '');
response.type(response._contentType + charset);
}
else if (Buffer.isBuffer(response.source)) {
response.type('application/octet-stream');
}
else if (response.variety === 'plain' &&
response.source !== null) {
response.type('application/json' + charset);
}
}
else if (response.settings.charset &&
else if ((!response._contentType || !postMarshal) &&
response.settings.charset &&
type.match(/^(?:text\/)|(?:application\/(?:json)|(?:javascript))/)) {

@@ -454,0 +450,0 @@

{
"name": "hapi",
"version": "13.1.0",
"version": "13.2.0",
"dependencies": {

@@ -5,0 +5,0 @@ "accept": {

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

"homepage": "http://hapijs.com",
"version": "13.1.0",
"version": "13.2.0",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -1569,3 +1569,3 @@ 'use strict';

expect(res.statusCode).to.equal(205);
expect(res.headers['content-type']).to.contain('text/html');
expect(res.headers['content-type']).to.equal('text/html; charset=utf-8');
expect(res.headers['content-length']).to.not.exist();

@@ -1572,0 +1572,0 @@ expect(res.headers.etag).to.equal('"test"');

@@ -883,6 +883,6 @@ 'use strict';

return callback(null, response.source);
return callback(null, response.source.value);
};
return reply(request.generateResponse('text', { variety: 'test', marshal }));
return reply(request.generateResponse({ value: 'text' }, { variety: 'test', marshal }));
};

@@ -889,0 +889,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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