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

dat-middleware

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dat-middleware - npm Package Compare versions

Comparing version 1.1.3 to 1.2.0

test/setFromReq.js

19

lib/RequestData.js

@@ -282,3 +282,18 @@ var error = require('./error');

RequestData.prototype.set = function (key, value) {
return this.transform(utils.set(key, value));
return this.transform(function (data, req) {
data = utils.set(key, value)(data);
if (typeof key === 'object') {
Object.keys(key).forEach(function (key) {
if (typeof data[key] === 'string') {
data[key] = keypather.get(req, data[key]) || data[key];
}
});
}
else {
if (typeof data[key] === 'string') {
data[key] = keypather.get(req, value) || value;
}
}
return data;
});
};

@@ -413,3 +428,3 @@ /**

var dataType = this.dataType;
req[dataType] = step.transformation(req[dataType]);
req[dataType] = step.transformation(req[dataType], req);
}

@@ -416,0 +431,0 @@ else {

2

package.json
{
"name": "dat-middleware",
"version": "1.1.3",
"version": "1.2.0",
"description": "common request, response, body, query, and param validation, transformation, and flow control middleware",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -68,3 +68,2 @@ var createAppWithMiddleware = require('./fixtures/createAppWithMiddleware');

var params = dataType === 'params' ? values(data) : [];
console.log('body',body);
request(this.app)

@@ -71,0 +70,0 @@ .post('/'+dataType, params, query)

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