Socket
Socket
Sign inDemoInstall

mm

Package Overview
Dependencies
Maintainers
3
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mm - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

5

History.md
2.0.1 / 2017-01-22
==================
* fix: Only restore the http/https request when used.
2.0.0 / 2016-07-31

@@ -3,0 +8,0 @@ ==================

22

lib/mm.js

@@ -204,4 +204,2 @@ /**!

getAgent(http).__sourceRequest = getAgent(http).request;
getAgent(https).__sourceRequest = getAgent(https).request;

@@ -257,2 +255,3 @@ function matchURL(options, params) {

exports.http.request = function(url, data, headers, delay) {
backupOriginalRequest(http);
return _request.call(this, http, url, data, headers, delay);

@@ -272,5 +271,12 @@ };

exports.https.request = function(url, data, headers, delay) {
backupOriginalRequest(https);
return _request.call(this, https, url, data, headers, delay);
};
function backupOriginalRequest(mod) {
if (!getAgent(mod).__sourceRequest) {
getAgent(mod).__sourceRequest = getAgent(mod).request;
}
}
function _request(mod, url, data, headers, delay) {

@@ -363,2 +369,3 @@ headers = headers || {};

exports.http.requestError = function(url, reqError, resError, delay) {
backupOriginalRequest(http);
_requestError.call(this, http, url, reqError, resError, delay);

@@ -375,2 +382,3 @@ };

exports.https.requestError = function(url, reqError, resError, delay) {
backupOriginalRequest(https);
_requestError.call(this, https, url, reqError, resError, delay);

@@ -454,4 +462,10 @@ };

exports.restore = function() {
getAgent(http).request = getAgent(http).__sourceRequest;
getAgent(https).request = getAgent(https).__sourceRequest;
if (getAgent(http).__sourceRequest) {
getAgent(http).request = getAgent(http).__sourceRequest;
getAgent(http).__sourceRequest = null;
}
if (getAgent(https).__sourceRequest) {
getAgent(https).request = getAgent(https).__sourceRequest;
getAgent(https).__sourceRequest = null;
}
muk.restore();

@@ -458,0 +472,0 @@ return this;

2

package.json
{
"name": "mm",
"version": "2.0.0",
"version": "2.0.1",
"description": "mock mate, mock http request, fs access and so on.",

@@ -5,0 +5,0 @@ "main": "index.js",

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