Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mvcjs

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mvcjs - npm Package Compare versions

Comparing version 0.1.0-beta-65 to 0.1.0-beta-66

52

framework/core/request.js

@@ -12,2 +12,3 @@ "use strict";

Type = di.load('typejs'),
zlib = di.load('zlib'),
core = di.load('core'),

@@ -44,2 +45,3 @@ error = di.load('error'),

isForwarded: Type.BOOLEAN,
isCompressed: Type.BOOLEAN,
encoding: Type.STRING,

@@ -62,2 +64,3 @@ body: Type.OBJECT,

this.isRendered = false;
this.isCompressed = false;
this.id = this._uuid();

@@ -437,3 +440,3 @@ },

this.request.on('data', function (body) {
this.body = body;
this.body = body;
}.bind(this));

@@ -483,11 +486,57 @@

}.bind(this)) // handle hook chain
.then(this._compress.bind(this))
.then(this._render.bind(this)) // resolve route chain
.catch(this._handleError.bind(this)) // catch hook error
.then(this._compress.bind(this))
.then(this._render.bind(this)) // render hook error
.catch(this._handleError.bind(this)) // catch render error
.then(this._compress.bind(this))
.then(this._render.bind(this)); // resolve render error
},
/**
* @since 0.0.1
* @author Igor Ivanovic
* @method Request#_compress
*
* @description
* Compress output
* @return object
*/
_compress: function Request__compress(response) {
var accept = this.getRequestHeader('Accept-Encoding'),
isForCompress = (Type.isString(response) || response instanceof Buffer) && !this.isCompressed;
if (isForCompress) {
if (accept.indexOf('gzip') > -1) {
this.addHeader('Content-Encoding', 'gzip');
this.isCompressed = true;
return new Promise(function (resolve, reject) {
zlib.gzip(response, function (err, data) {
if (err) {
return reject(err);
}
resolve(data);
});
});
} else if (accept.indexOf('deflate') > -1) {
this.addHeader('Content-Encoding', 'deflate');
this.isCompressed = true;
return new Promise(function (resolve, reject) {
zlib.deflate(response, function (err, data) {
if (err) {
return reject(err);
}
resolve(data);
});
});
}
}
return response;
},
/**
* @since 0.0.1
* @author Igor Ivanovic
* @method Request#_checkContentType

@@ -569,2 +618,3 @@ *

},
/**

@@ -571,0 +621,0 @@ * @since 0.0.1

2

package.json

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

"description": "Powerful lightweight mvc framework for nodejs",
"version": "0.1.0-beta-65",
"version": "0.1.0-beta-66",
"dependencies" : {

@@ -8,0 +8,0 @@ "mongoose": "3.8.x",

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