Socket
Socket
Sign inDemoInstall

fetch-mock

Package Overview
Dependencies
Maintainers
3
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-mock - npm Package Compare versions

Comparing version 9.3.1 to 9.4.0

2

cjs/lib/compile-route.js

@@ -117,3 +117,3 @@ const { debug, setDebugNamespace, getDebug } = require('./debug');

)
.filter(matcher => !!matcher);
.filter(matcher => Boolean(matcher));

@@ -120,0 +120,0 @@ route.usesBody = matchers.some(({ usesBody }) => usesBody);

@@ -53,8 +53,13 @@ const { debug } = require('./debug');

// object that this function should be bound to
const proxy = (url, options) => sandbox.fetchHandler(url, options);
const fetchMockProxy = (url, options) => sandbox.fetchHandler(url, options);
const sandbox = Object.assign(
proxy, // Ensures that the entire returned object is a callable function
fetchMockProxy, // Ensures that the entire returned object is a callable function
FetchMock, // prototype methods
this.createInstance() // instance data
this.createInstance(), // instance data
{
Headers: this.config.Headers,
Request: this.config.Request,
Response: this.config.Response
}
);

@@ -64,2 +69,3 @@

sandbox.isSandbox = true;
sandbox.default = sandbox;
return sandbox;

@@ -66,0 +72,0 @@ };

@@ -90,3 +90,3 @@ const { setDebugPhase, setDebugNamespace, debug } = require('./debug');

debug('checking if matching call was made');
return !!this.filterCalls(nameOrMatcher, options).length;
return Boolean(this.filterCalls(nameOrMatcher, options).length);
});

@@ -93,0 +93,0 @@

@@ -44,5 +44,3 @@ let URL;

return request.clone().text();
} catch (err) {
return;
}
} catch (err) {}
};

@@ -49,0 +47,0 @@

@@ -86,3 +86,3 @@ const { getDebug } = require('./debug');

this.options.statusText = this.fetchMock.statusTextMap[
'' + this.options.status
String(this.options.status)
];

@@ -89,0 +89,0 @@ // Set up response headers. The empty object is to cope with

@@ -152,3 +152,3 @@ 'use strict';

}).filter(function (matcher) {
return !!matcher;
return Boolean(matcher);
});

@@ -155,0 +155,0 @@

@@ -60,13 +60,18 @@ 'use strict';

// object that this function should be bound to
var proxy = function proxy(url, options) {
var fetchMockProxy = function fetchMockProxy(url, options) {
return sandbox.fetchHandler(url, options);
};
var sandbox = (0, _assign2.default)(proxy, // Ensures that the entire returned object is a callable function
var sandbox = (0, _assign2.default)(fetchMockProxy, // Ensures that the entire returned object is a callable function
FetchMock, // prototype methods
this.createInstance() // instance data
);
this.createInstance(), // instance data
{
Headers: this.config.Headers,
Request: this.config.Request,
Response: this.config.Response
});
sandbox.bindMethods();
sandbox.isSandbox = true;
sandbox.default = sandbox;
return sandbox;

@@ -73,0 +78,0 @@ };

@@ -142,3 +142,3 @@ 'use strict';

debug('checking if matching call was made');
return !!this.filterCalls(nameOrMatcher, options).length;
return Boolean(this.filterCalls(nameOrMatcher, options).length);
});

@@ -145,0 +145,0 @@

@@ -104,5 +104,4 @@ 'use strict';

_context.t0 = _context['catch'](0);
return _context.abrupt('return');
case 9:
case 8:
case 'end':

@@ -109,0 +108,0 @@ return _context.stop();

@@ -110,3 +110,3 @@ 'use strict';

this.options.status = this.validateStatus(this.responseConfig.status);
this.options.statusText = this.fetchMock.statusTextMap['' + this.options.status];
this.options.statusText = this.fetchMock.statusTextMap[String(this.options.status)];
// Set up response headers. The empty object is to cope with

@@ -113,0 +113,0 @@ // new Headers(undefined) throwing in Chrome

{
"name": "fetch-mock",
"type": "module",
"version": "9.3.1",
"version": "9.4.0",
"description": "Mock http requests made using fetch (or isomorphic-fetch)",

@@ -88,3 +88,3 @@ "main": "./cjs/server.js",

"eslint": "^4.14.0",
"eslint-config-origami-component": "^1.0.0",
"eslint-config-origami-component": "1.0.0",
"eslint-config-prettier": "^2.9.0",

@@ -91,0 +91,0 @@ "eslint-plugin-prettier": "^2.6.1",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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