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

connect-rest

Package Overview
Dependencies
Maintainers
1
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-rest - npm Package Compare versions

Comparing version 0.9.12 to 0.9.13

2

lib/bus.js

@@ -40,3 +40,3 @@ function Bus(httphelper) {

metrics.count++;
metrics.count+=1;
} );

@@ -43,0 +43,0 @@ }

@@ -47,3 +47,3 @@ /*

function(request, content, callback){
if(action.length == 3) {
if(action.length === 3) {
action(request, content, function(err, result, resOptions){

@@ -129,6 +129,6 @@ callback(err, { contentType: options.contentType || 'application/json', result : result, resOptions: resOptions || {} } );

httphelper.generalCall( asyncCall, 'POST', null, err, result, 'application/json', logger, function(err, result, status){
if(er)
logger.error( er );
if(err)
logger.error( err );
else
logger.info('Response:', response, status);
logger.info('Response:', result, status);
} );

@@ -146,3 +146,3 @@ } else{

res.end( (result.contentType == 'application/json') ? util.stringify( result.result, result.resOptions.minify, _ ) : result.result );
res.end( (result.contentType === 'application/json') ? util.stringify( result.result, result.resOptions.minify, _ ) : result.result );
}

@@ -175,15 +175,15 @@ }

exports.assign = function headRest(methods, path, functionRef, prototypeObject, options){
if( _.isString(methods) && methods == '*' ){
if( _.isString(methods) && methods === '*' ){
exports.assign( ['head','get','post','put','delete'], path, functionRef, prototypeObject, options );
} else if( _.isArray(methods) ){
_.each( methods, function(element, index, list){
if( element == 'head' )
if( element === 'head' )
addPath("HEAD", path, functionRef, null, options );
else if( element == 'get' )
else if( element === 'get' )
addPath("GET", path, functionRef, null, options );
else if( element == 'post' )
else if( element === 'post' )
addPath("POST", path, functionRef, prototypeObject, options );
else if( element == 'put' )
else if( element === 'put' )
addPath("PUT", path, functionRef, prototypeObject, options );
else if( element == 'delete' )
else if( element === 'delete' )
addPath("DELETE", path, functionRef, prototypeObject, options );

@@ -200,6 +200,6 @@ else logger.error('Not known rest type:', element);

if( _.isFunction( element ) && SERVICE_METHOD_PATTERN.test( element.name ) ){
if( element.length == 1 )
getRest( '/' + element.name, element );
if( element.length == 2 )
postRest( '/' + element.name, element );
if( element.length === 1 )
exports.get( '/' + element.name, element );
if( element.length === 2 )
exports.post( '/' + element.name, element );
}

@@ -209,3 +209,3 @@ } );

exports.checkCall = function( req ){
exports.checkCall = function( req, res ){
if(!req.query) req.query = {};

@@ -218,3 +218,3 @@ var pathname = url.parse( req.url ).pathname;

mapping[ req.method ], function(route){ return route.matches(
req, pathname, req.headers['accept-version'] || req.headers['x-api-version'] || '*', _, semver, false, (API_KEYS && API_KEYS.indexOf( apiKey )==-1)
req, pathname, req.headers['accept-version'] || req.headers['x-api-version'] || '*', _, semver, false, (API_KEYS && API_KEYS.indexOf( apiKey ) === -1)
) && (!route.options.validator || route.options.validator(req, res) ); }

@@ -297,3 +297,3 @@ );

mapping[ req.method ], function(route){ return route.matches(
req, pathname, req.headers['accept-version'] || req.headers['x-api-version'] || '*', _, semver, true, (API_KEYS && API_KEYS.indexOf(apiKey)==-1)
req, pathname, req.headers['accept-version'] || req.headers['x-api-version'] || '*', _, semver, true, (API_KEYS && API_KEYS.indexOf(apiKey )=== -1)
) && (!route.options.validator || route.options.validator(req, res) ); }

@@ -307,3 +307,3 @@ );

if( matching.length === 0 ){
if( API_KEYS && API_KEYS.indexOf(req.query.api_key)==-1 ){
if( API_KEYS && API_KEYS.indexOf(req.query.api_key) === -1 ){
logger.info('Request without api key.', req.query );

@@ -310,0 +310,0 @@

@@ -37,3 +37,3 @@ var PARAMETER_M_DELIMETER = ':';

Path.prototype.innerMatches = function( _, pathname, path, parameterReplacements ){
if (path == '*')
if (path === '*')
return true;

@@ -44,4 +44,4 @@

if( ptokens.length != utokens.length ){
for (var i=1; i<=ptokens.length; i++)
if( ptokens.length !== utokens.length ){
for (var i=1; i<=ptokens.length; i+=1)
if( _.str.startsWith( ptokens[ ptokens.length-i ], PARAMETER_O_DELIMETER ) && utokens.length < ptokens.length ){

@@ -67,3 +67,3 @@ utokens.splice( utokens.length-i + 1, 0, '' );

for (var t=0; t<utokens.length; t++){
for (var t=0; t<utokens.length; t+=1){
if( _.str.startsWith( ptokens[t], PARAMETER_M_DELIMETER ) )

@@ -78,3 +78,3 @@ parameterReplacements[ ptokens[t].substring( PARAMETER_M_DELIMETER.length ) ] = utokens[t];

else {
if( ptokens[t].toUpperCase() != utokens[t].toUpperCase() )
if( ptokens[t].toUpperCase() !== utokens[t].toUpperCase() )
return false;

@@ -81,0 +81,0 @@ }

@@ -19,7 +19,8 @@ exports.minify = function(json) {

}
new_str[ns++] = tmp2;
new_str[ns] = tmp2;
ns+=1;
}
from = tokenizer.lastIndex;
if (tmp[0] == '\"' && !in_multiline_comment && !in_singleline_comment) {
if (tmp[0] === '\"' && !in_multiline_comment && !in_singleline_comment) {
tmp2 = lc.match(/(\\)*$/);

@@ -29,22 +30,24 @@ if (!in_string || !tmp2 || (tmp2[0].length % 2) === 0) { // start of string with ", or unescaped " character found to end string

}
from--; // include " character in next catch
from -= 1; // include " character in next catch
rc = json.substring(from);
}
else if (tmp[0] == '/*' && !in_string && !in_multiline_comment && !in_singleline_comment) {
else if (tmp[0] === '/*' && !in_string && !in_multiline_comment && !in_singleline_comment) {
in_multiline_comment = true;
}
else if (tmp[0] == '*/' && !in_string && in_multiline_comment && !in_singleline_comment) {
else if (tmp[0] === '*/' && !in_string && in_multiline_comment && !in_singleline_comment) {
in_multiline_comment = false;
}
else if (tmp[0] == '//' && !in_string && !in_multiline_comment && !in_singleline_comment) {
else if (tmp[0] === '//' && !in_string && !in_multiline_comment && !in_singleline_comment) {
in_singleline_comment = true;
}
else if ((tmp[0] == '\n' || tmp[0] == '\r') && !in_string && !in_multiline_comment && in_singleline_comment) {
else if ((tmp[0] === '\n' || tmp[0] === '\r') && !in_string && !in_multiline_comment && in_singleline_comment) {
in_singleline_comment = false;
}
else if (!in_multiline_comment && !in_singleline_comment && !(/\n|\r|\s/.test(tmp[0]))) {
new_str[ns++] = tmp[0];
new_str[ns] = tmp[0];
ns += 1;
}
}
new_str[ns++] = rc;
new_str[ns] = rc;
ns += 1;

@@ -51,0 +54,0 @@ return new_str.join( '' );

{
"name": "connect-rest",
"version": "0.9.12",
"version": "0.9.13",
"description": "Exceptionally featureful RESTful web services middleware for Connect.",

@@ -50,3 +50,3 @@ "keywords": [

},
"_id": "connect-rest@0.9.12"
"_id": "connect-rest@0.9.13"
}

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