Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

fetch-mock

Package Overview
Dependencies
Maintainers
1
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 5.6.0 to 5.6.1

35

es5/client-browserified.js

@@ -162,15 +162,2 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.fetchMock = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

this.config = {
sendAsJson: true
};
// if (opts) {
// FetchMock.Headers = opts.Headers;
// FetchMock.Request = opts.Request;
// FetchMock.Response = opts.Response;
// FetchMock.stream = opts.stream;
// FetchMock.global = opts.global;
// FetchMock.statusTextMap = opts.statusTextMap;
// }
this.routes = [];

@@ -194,7 +181,3 @@ this._calls = {};

// Handle the variety of parameters accepted by mock (see README)
// Old method matching signature
if (options && /^[A-Z]+$/.test(response)) {
throw new Error('The API for method matching has changed.\n\t\t\tNow use .get(), .post(), .put(), .delete() and .head() shorthand methods,\n\t\t\tor pass in, e.g. {method: \'PATCH\'} as a third paramter');
} else if (options) {
if (matcher && response && options) {
route = _extends({

@@ -334,3 +317,3 @@ matcher: matcher,

opts.url = url;
opts.sendAsJson = responseConfig.sendAsJson === undefined ? this.config.sendAsJson : responseConfig.sendAsJson;
opts.sendAsJson = responseConfig.sendAsJson === undefined ? FetchMock.config.sendAsJson : responseConfig.sendAsJson;
if (responseConfig.status && (typeof responseConfig.status !== 'number' || parseInt(responseConfig.status, 10) !== responseConfig.status || responseConfig.status < 200 || responseConfig.status > 599)) {

@@ -445,6 +428,14 @@ throw new TypeError('Invalid status ' + responseConfig.status + ' passed on response object.\nTo respond with a JSON object that has status as a property assign the object to body\ne.g. {"body": {"status: "registered"}}');

FetchMock.config = {
sendAsJson: true
};
FetchMock.prototype.configure = function (opts) {
_extends(this.config, opts);
_extends(FetchMock.config, opts);
};
FetchMock.setGlobals = function (globals) {
_extends(FetchMock, globals);
};
FetchMock.prototype.sandbox = function () {

@@ -465,6 +456,2 @@ if (this.routes.length || this.fallbackResponse) {

FetchMock.setGlobals = function (globals) {
_extends(FetchMock, globals);
};
['get', 'post', 'put', 'delete', 'head', 'patch'].forEach(function (method) {

@@ -471,0 +458,0 @@ FetchMock.prototype[method] = function (matcher, response, options) {

@@ -11,15 +11,2 @@ 'use strict';

this.config = {
sendAsJson: true
};
// if (opts) {
// FetchMock.Headers = opts.Headers;
// FetchMock.Request = opts.Request;
// FetchMock.Response = opts.Response;
// FetchMock.stream = opts.stream;
// FetchMock.global = opts.global;
// FetchMock.statusTextMap = opts.statusTextMap;
// }
this.routes = [];

@@ -43,7 +30,3 @@ this._calls = {};

// Handle the variety of parameters accepted by mock (see README)
// Old method matching signature
if (options && /^[A-Z]+$/.test(response)) {
throw new Error('The API for method matching has changed.\n\t\t\tNow use .get(), .post(), .put(), .delete() and .head() shorthand methods,\n\t\t\tor pass in, e.g. {method: \'PATCH\'} as a third paramter');
} else if (options) {
if (matcher && response && options) {
route = _extends({

@@ -183,3 +166,3 @@ matcher: matcher,

opts.url = url;
opts.sendAsJson = responseConfig.sendAsJson === undefined ? this.config.sendAsJson : responseConfig.sendAsJson;
opts.sendAsJson = responseConfig.sendAsJson === undefined ? FetchMock.config.sendAsJson : responseConfig.sendAsJson;
if (responseConfig.status && (typeof responseConfig.status !== 'number' || parseInt(responseConfig.status, 10) !== responseConfig.status || responseConfig.status < 200 || responseConfig.status > 599)) {

@@ -294,6 +277,14 @@ throw new TypeError('Invalid status ' + responseConfig.status + ' passed on response object.\nTo respond with a JSON object that has status as a property assign the object to body\ne.g. {"body": {"status: "registered"}}');

FetchMock.config = {
sendAsJson: true
};
FetchMock.prototype.configure = function (opts) {
_extends(this.config, opts);
_extends(FetchMock.config, opts);
};
FetchMock.setGlobals = function (globals) {
_extends(FetchMock, globals);
};
FetchMock.prototype.sandbox = function () {

@@ -314,6 +305,2 @@ if (this.routes.length || this.fallbackResponse) {

FetchMock.setGlobals = function (globals) {
_extends(FetchMock, globals);
};
['get', 'post', 'put', 'delete', 'head', 'patch'].forEach(function (method) {

@@ -320,0 +307,0 @@ FetchMock.prototype[method] = function (matcher, response, options) {

{
"name": "fetch-mock",
"version": "5.6.0",
"version": "5.6.1",
"description": "Mock http requests made using fetch (or isomorphic-fetch)",

@@ -5,0 +5,0 @@ "main": "src/server.js",

@@ -7,15 +7,2 @@ 'use strict';

this.config = {
sendAsJson: true
}
// if (opts) {
// FetchMock.Headers = opts.Headers;
// FetchMock.Request = opts.Request;
// FetchMock.Response = opts.Response;
// FetchMock.stream = opts.stream;
// FetchMock.global = opts.global;
// FetchMock.statusTextMap = opts.statusTextMap;
// }
this.routes = [];

@@ -39,9 +26,3 @@ this._calls = {};

// Handle the variety of parameters accepted by mock (see README)
// Old method matching signature
if (options && /^[A-Z]+$/.test(response)) {
throw new Error(`The API for method matching has changed.
Now use .get(), .post(), .put(), .delete() and .head() shorthand methods,
or pass in, e.g. {method: 'PATCH'} as a third paramter`);
} else if (options) {
if (matcher && response && options) {
route = Object.assign({

@@ -180,3 +161,3 @@ matcher,

opts.url = url;
opts.sendAsJson = responseConfig.sendAsJson === undefined ? this.config.sendAsJson : responseConfig.sendAsJson;
opts.sendAsJson = responseConfig.sendAsJson === undefined ? FetchMock.config.sendAsJson : responseConfig.sendAsJson;
if (responseConfig.status && (typeof responseConfig.status !== 'number' || parseInt(responseConfig.status, 10) !== responseConfig.status || responseConfig.status < 200 || responseConfig.status > 599)) {

@@ -282,6 +263,14 @@ throw new TypeError(`Invalid status ${responseConfig.status} passed on response object.

FetchMock.config = {
sendAsJson: true
}
FetchMock.prototype.configure = function (opts) {
Object.assign(this.config, opts);
Object.assign(FetchMock.config, opts);
}
FetchMock.setGlobals = function (globals) {
Object.assign(FetchMock, globals)
}
FetchMock.prototype.sandbox = function () {

@@ -303,6 +292,2 @@ if (this.routes.length || this.fallbackResponse) {

FetchMock.setGlobals = function (globals) {
Object.assign(FetchMock, globals)
};
['get','post','put','delete','head', 'patch']

@@ -309,0 +294,0 @@ .forEach(method => {

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