autohost
Advanced tools
Comparing version 0.6.1 to 1.0.0
@@ -1,3 +0,16 @@ | ||
## 0.5.x | ||
## 1.x | ||
### 1.0.0 | ||
* change order of operations of merge operations into `data` to prefer url parameter, then request body, then parameter | ||
* request body is deep cloned to the data propert on HttpEnvelope to avoid | ||
* add query, parameter, and body properties to envelope | ||
## 0.6.x | ||
### 0.6.2 | ||
* Bug fix - change order of merge operations into `data` to prefer url parameter, then request body, then query parameter. | ||
* Bug fix - clone request body to data property on envelope; do not copy reference and allow mutation | ||
* Improvement - add query, parameter and body properties to envelope | ||
### 0.6.1 | ||
@@ -12,2 +25,4 @@ | ||
## 0.5.x | ||
### 0.5.12 | ||
@@ -14,0 +29,0 @@ |
{ | ||
"name": "autohost", | ||
"version": "0.6.1", | ||
"version": "1.0.0", | ||
"description": "Resource driven, transport agnostic host", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -12,3 +12,12 @@ var request; | ||
this.cookies = req.cookies; | ||
this.data = req.body || {}; | ||
this.data; | ||
if( req.data ) { | ||
this.data = req.data; | ||
} else { | ||
this.data = req.body ? _.cloneDeep( req.body ) : {}; | ||
} | ||
this.body = req.body || {}; | ||
this.query = req.query || {}; | ||
this.params = req.params || {}; | ||
this.files = req.files; | ||
@@ -20,3 +29,3 @@ this.headers = req.headers || {}; | ||
this.metricKey = metricKey; | ||
this.params = {}; | ||
this.path = this.url = req.url; | ||
@@ -35,12 +44,11 @@ this.method = req.method.toLowerCase(); | ||
[ req.params, req.query ].forEach( function( source ) { | ||
Object.keys( source ).forEach( function( key ) { | ||
var val = source[ key ]; | ||
if ( !_.has( this.data, key ) ) { | ||
this.data[ key ] = val; | ||
} | ||
if ( !_.has( this.params, key ) ) { | ||
this.params[ key ] = val; | ||
} | ||
}.bind( this ) ); | ||
_.extend( this.data, req.params ); | ||
Object.keys( req.query ).forEach( function( key ) { | ||
var val = req.query[ key ]; | ||
if ( !this.data.hasOwnProperty( key ) ) { | ||
this.data[ key ] = val; | ||
} | ||
if ( !this.params.hasOwnProperty( key ) ) { | ||
this.params[ key ] = val; | ||
} | ||
}.bind( this ) ); | ||
@@ -47,0 +55,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2631
0
159734
3