Socket
Socket
Sign inDemoInstall

nock

Package Overview
Dependencies
Maintainers
1
Versions
430
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 0.1.5 to 0.1.6

20

lib/scope.js

@@ -6,2 +6,4 @@ var path = require('path')

var noop = function() {};
function startScope(basePath) {

@@ -11,3 +13,4 @@ var interceptors = {}

, transformPathFunction
, transformRequestBodyFunction;
, transformRequestBodyFunction
, logger = noop;

@@ -64,4 +67,6 @@ function add(key, interceptor) {

function match(options, body) {
var method = options.method || 'GET';
var path = options.path;
var method = options.method || 'GET'
, path = options.path
, matches;
if (transformPathFunction) { path = transformPathFunction(path); }

@@ -74,3 +79,5 @@ if (typeof(body) !== 'string') {

if (body) { matchKey += (' ' + body); }
return matchKey === this._key;
matches = matchKey === this._key;
logger('matching ' + matchKey + ' to ' + this._key + ': ' + matches);
return matches;
}

@@ -165,2 +172,6 @@

function log(newLogger) {
logger = newLogger;
}
scope = {

@@ -174,2 +185,3 @@ get: get

, filteringRequestBody: filteringRequestBody
, log: log
};

@@ -176,0 +188,0 @@

2

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

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

@@ -134,4 +134,12 @@ # Nock

# Logging
Nock can log matches if you pass in a log function like this:
var google = nock('http://google.com')
.log(console.log)
...
# How does it work?
Nock works by overriding Node's http.request function.
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