You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

nock

Package Overview
Dependencies
Maintainers
1
Versions
446
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nock - npm Package Compare versions

Comparing version

to
0.17.4

39

lib/scope.js

@@ -258,7 +258,7 @@ var path = require('path')

function filteringPath() {
function buildFilter() {
var filteringArguments = arguments;
if (arguments[0] instanceof RegExp) {
transformPathFunction = function(path) {
return function(path) {
if (path) {

@@ -268,10 +268,12 @@ path = path.replace(filteringArguments[0], filteringArguments[1]);

return path;
}
} else {
if (typeof (arguments[0]) === 'function') {
transformPathFunction = arguments[0];
} else {
throw new Error('Invalid arguments: filtering path should be a function or a regular expression');
}
};
} else if (typeof (arguments[0]) === 'function') {
return arguments[0];
}
}
function filteringPath() {
transformPathFunction = buildFilter.apply(undefined, arguments);
if (!transformPathFunction)
throw new Error('Invalid arguments: filtering path should be a function or a regular expression');
return this;

@@ -281,18 +283,5 @@ }

function filteringRequestBody() {
var filteringArguments = arguments;
if (arguments[0] instanceof RegExp) {
transformRequestBodyFunction = function(path) {
if (path) {
path = path.replace(filteringArguments[0], filteringArguments[1]);
}
return path;
}
} else {
if (typeof (arguments[0]) === 'function') {
transformRequestBodyFunction = arguments[0];
} else {
throw new Error('Invalid arguments: filtering request body should be a function or a regular expression');
}
}
transformRequestBodyFunction = buildFilter.apply(undefined, arguments);
if (!transformRequestBodyFunction)
throw new Error('Invalid arguments: filtering request body should be a function or a regular expression');
return this;

@@ -299,0 +288,0 @@ }

{ "name" : "nock"
, "description" : "HTTP Server mocking for Node.js"
, "tags" : ["Mock", "HTTP", "testing", "isolation"]
, "version" : "0.17.3"
, "version" : "0.17.4"
, "author" : "Pedro Teixeira <pedro.teixeira@gmail.com>"

@@ -6,0 +6,0 @@ , "contributors" :

@@ -36,3 +36,3 @@ # Nock [![Build Status](https://secure.travis-ci.org/flatiron/nock.png)](http://travis-ci.org/flatiron/nock)

When you setup an interceptor for an URL and that interceptor is used, it is removed from the interceptor list.
This means that if you can intercept 2 or more calls to the same URL and return different things on each of them.
This means that you can intercept 2 or more calls to the same URL and return different things on each of them.
It also means that you must setup one interceptor for each request you are going to have, otherwise nock will throw an error because that URL was not present in the interceptor list.

@@ -39,0 +39,0 @@

@@ -30,4 +30,2 @@ var nock = require('../.')

return;
test("get gets mocked", function(t) {

@@ -1795,2 +1793,2 @@ var dataCalled = false

});
});
});