Socket
Socket
Sign inDemoInstall

autohost

Package Overview
Dependencies
195
Maintainers
7
Versions
110
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.1 to 1.0.0

.vscode/settings.json

17

CHANGELOG.md

@@ -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 @@

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc