Socket
Socket
Sign inDemoInstall

express-mock-api-middleware

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-mock-api-middleware - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

21

lib/createMockMiddleware.js

@@ -100,4 +100,5 @@ "use strict";

path = splited[1]; // eslint-disable-line
}
} // debug(`parsed: ${method} ${path}`);
(0, _assert.default)(VALID_METHODS.includes(method), "Invalid method ".concat(method, " for path ").concat(path, ", please check your mock files."));

@@ -153,3 +154,8 @@ return {

var keys = [];
var re = (0, _pathToRegexp.default)(path, keys);
var pathOptions = {
whitelist: ['%'] // treat %3A as regular chars
};
var re = (0, _pathToRegexp.default)(path, keys, pathOptions); // debug(re);
memo.push({

@@ -175,4 +181,5 @@ method: method,

function matchMock(req) {
var exceptPath = req.path;
var exceptMethod = req.method.toLowerCase();
var targetPath = req.path;
var targetMethod = req.method.toLowerCase(); // debug(`${targetMethod} ${targetPath}`);
var _iteratorNormalCompletion = true;

@@ -189,4 +196,4 @@ var _didIteratorError = false;

if (method === exceptMethod) {
var match = re.exec(req.path);
if (method === targetMethod) {
var match = re.exec(targetPath);

@@ -247,3 +254,3 @@ if (match) {

re = _ref.re;
return method === exceptMethod && re.test(exceptPath);
return method === targetMethod && re.test(targetPath);
})[0];

@@ -250,0 +257,0 @@ }

{
"name": "express-mock-api-middleware",
"version": "1.0.3",
"version": "1.0.4",
"description": "Express middleware for mocking restful APIs",

@@ -8,3 +8,3 @@ "main": "lib/index.js",

"build": "babel src -d lib",
"prepack": "npm build"
"prepack": "npm run build"
},

@@ -11,0 +11,0 @@ "repository": {

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