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

ee-soa-transport-rewrite

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-soa-transport-rewrite - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

lib/rewrite/Method.js

2

lib/loader/FilterLoader.js

@@ -10,3 +10,3 @@ "use strict";

_loader: null
_loader: null
, _comparator: null

@@ -13,0 +13,0 @@ , _loaderKeyFun: null

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

, ensure: rewrites.Ensure
, method: rewrites.Method
, override: rewrites.Override

@@ -26,0 +27,0 @@ , template: rewrites.Template

@@ -9,2 +9,3 @@ module.exports.Append = require('./Append');

module.exports.Path = require('./Path');
module.exports.Option = require('./Option');
module.exports.Option = require('./Option');
module.exports.Method = require('./Method');

@@ -26,7 +26,8 @@ "use strict";

}
} else {
}
else {
val = this.value;
}
if(!('rewriteParameters' in request)){
if(!('rewriteParameters' in request)) {
request['rewriteParameters'] = {};

@@ -33,0 +34,0 @@ }

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

}
, init: function(rule, loader){

@@ -48,0 +49,0 @@ rule = rule || {};

{
"name" : "ee-soa-transport-rewrite"
, "description" : "Rewriting middleware for the ee-soa-transports"
, "version" : "0.1.4"
, "version" : "0.1.5"
, "homepage" : "https://github.com/eventEmitter/ee-soa-transport-rewrite"

@@ -6,0 +6,0 @@ , "author" : {

@@ -16,2 +16,3 @@ #ee-soa-transport-rewrite

- **override** overrides the header `field` with `value`.
- **method** overrides the method of the request if the `field` value matches the incoming request method (rewrites all if `field` is not set) with its `value`
- **path** modifies the requested pathname `path` to `value` (use to map to api endpoints).

@@ -18,0 +19,0 @@ - **template** sets a template variable, basically `request.template = rule.value`

@@ -169,3 +169,2 @@ var assert = require('assert');

});
});

@@ -209,2 +208,32 @@ });

describe('Method', function(){
describe('#execute', function(){
var getToPut = new rewrites.Method({domain:'test.com', path:null, field: 'GET', value: 'Put'})
, toPut = new rewrites.Method({domain: 'test.com', path: null, value: 'Put'})
, request = new Request('test.com')
, requestPost = new Request('test.com', null, 'post');
it('should leave requests that do not match the incoming method untouched', function(done){
getToPut.execute(requestPost, function(err){
assert.equal('post', requestPost.method);
done(err);
});
});
it('should act case insensitively and set the correct new method it the incoming method matches', function(done){
getToPut.execute(request, function(err){
assert.equal('put', request.method);
done(err);
});
});
it('should modify every request if the incoming method is not set', function(done){
toPut.execute(requestPost, function(err){
assert.equal('put', requestPost.method);
done(err);
});
});
});
});
});
module.exports = function MockRequest(hostname, pathname) {
module.exports = function MockRequest(hostname, pathname, method) {
this.headers = {

@@ -12,2 +12,3 @@ select: ''

this.pathname = pathname || '/somewhere/10';
this.method = (method) ? method.toLowerCase() : 'get';

@@ -14,0 +15,0 @@ this.hasHeader = function(key){

Sorry, the diff of this file is not supported yet

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