UNPKG

@4c/fetch-mock

Version:

Mock http requests made using fetch (or isomorphic-fetch)

194 lines (168 loc) 1.08 MB
var fetchMock = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./es5/client.js"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./es5/client.js": /*!***********************!*\ !*** ./es5/client.js ***! \***********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/assign */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js\"));\n\nvar FetchMock = __webpack_require__(/*! ./lib/index */ \"./es5/lib/index.js\");\n\nvar statusTextMap = __webpack_require__(/*! ./lib/status-text */ \"./es5/lib/status-text.js\");\n\nvar theGlobal = typeof window !== 'undefined' ? window : self;\nFetchMock.global = theGlobal;\nFetchMock.statusTextMap = statusTextMap;\nFetchMock.config = (0, _assign[\"default\"])(FetchMock.config, {\n Promise: theGlobal.Promise,\n Request: theGlobal.Request,\n Response: theGlobal.Response,\n Headers: theGlobal.Headers\n});\nmodule.exports = FetchMock.createInstance(true);\n\n//# sourceURL=webpack://fetchMock/./es5/client.js?"); /***/ }), /***/ "./es5/lib/compile-route.js": /*!**********************************!*\ !*** ./es5/lib/compile-route.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n\nvar _repeat = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/repeat */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/repeat.js\"));\n\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/assign */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js\"));\n\nvar generateMatcher = __webpack_require__(/*! ./generate-matcher */ \"./es5/lib/generate-matcher.js\");\n\nvar sanitizeRoute = function sanitizeRoute(route) {\n route = (0, _assign[\"default\"])({}, route);\n\n if (route.method) {\n route.method = route.method.toLowerCase();\n }\n\n route.identifier = route.name || route.matcher;\n return route;\n};\n\nvar validateRoute = function validateRoute(route) {\n if (!('response' in route)) {\n throw new Error('fetch-mock: Each route must define a response');\n }\n\n if (!route.matcher) {\n throw new Error('fetch-mock: Each route must specify a string, regex or function to match calls to fetch');\n }\n};\n\nvar limitMatcher = function limitMatcher(route) {\n if (!(0, _repeat[\"default\"])(route)) {\n return;\n }\n\n var matcher = route.matcher;\n var timesLeft = (0, _repeat[\"default\"])(route);\n\n route.matcher = function (url, options) {\n var match = timesLeft && matcher(url, options);\n\n if (match) {\n timesLeft--;\n return true;\n }\n };\n\n route.reset = function () {\n return timesLeft = (0, _repeat[\"default\"])(route);\n };\n};\n\nmodule.exports = function (route) {\n validateRoute(route);\n route = sanitizeRoute(route);\n route.matcher = generateMatcher(route);\n limitMatcher(route);\n return route;\n};\n\nmodule.exports.sanitizeRoute = sanitizeRoute;\n\n//# sourceURL=webpack://fetchMock/./es5/lib/compile-route.js?"); /***/ }), /***/ "./es5/lib/fetch-handler.js": /*!**********************************!*\ !*** ./es5/lib/fetch-handler.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n\nvar _find = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/find */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/find.js\"));\n\nvar _concat = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/concat */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js\"));\n\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/regenerator */ \"./node_modules/@babel/runtime-corejs3/regenerator/index.js\"));\n\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/asyncToGenerator */ \"./node_modules/@babel/runtime-corejs3/helpers/asyncToGenerator.js\"));\n\nvar responseBuilder = __webpack_require__(/*! ./response-builder */ \"./es5/lib/response-builder.js\");\n\nvar requestUtils = __webpack_require__(/*! ./request-utils */ \"./es5/lib/request-utils.js\");\n\nvar FetchMock = {};\n\nvar resolve =\n/*#__PURE__*/\nfunction () {\n var _ref = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee(response, url, options, request) {\n return _regenerator[\"default\"].wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(typeof response === 'function' || typeof response.then === 'function')) {\n _context.next = 10;\n break;\n }\n\n if (!(typeof response === 'function')) {\n _context.next = 5;\n break;\n }\n\n response = response(url, options, request);\n _context.next = 8;\n break;\n\n case 5:\n _context.next = 7;\n return response;\n\n case 7:\n response = _context.sent;\n\n case 8:\n _context.next = 0;\n break;\n\n case 10:\n return _context.abrupt(\"return\", response);\n\n case 11:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function resolve(_x, _x2, _x3, _x4) {\n return _ref.apply(this, arguments);\n };\n}();\n\nFetchMock.fetchHandler = function (url, options, request) {\n var _this = this;\n\n var _requestUtils$normali = requestUtils.normalizeRequest(url, options, this.config.Request);\n\n url = _requestUtils$normali.url;\n options = _requestUtils$normali.options;\n request = _requestUtils$normali.request;\n var route = this.executeRouter(url, options, request); // this is used to power the .flush() method\n\n var done;\n\n this._holdingPromises.push(new this.config.Promise(function (res) {\n return done = res;\n })); // wrapped in this promise to make sure we respect custom Promise\n // constructors defined by the user\n\n\n return new this.config.Promise(function (res, rej) {\n if (options && options.signal) {\n var abort = function abort() {\n rej(new Error(\"URL '\".concat(url, \"' aborted.\")));\n done();\n };\n\n if (options.signal.aborted) {\n abort();\n }\n\n options.signal.addEventListener('abort', abort);\n }\n\n _this.generateResponse(route, url, options, request).then(res, rej).then(done, done);\n });\n};\n\nFetchMock.fetchHandler.isMock = true;\n\nFetchMock.executeRouter = function (url, options, request) {\n if (this.config.fallbackToNetwork === 'always') {\n return {\n response: this.getNativeFetch()\n };\n }\n\n var match = this.router(url, options, request);\n\n if (match) {\n return match;\n }\n\n if (this.config.warnOnFallback) {\n var _context2;\n\n console.warn((0, _concat[\"default\"])(_context2 = \"Unmatched \".concat(options && options.method || 'GET', \" to \")).call(_context2, url)); // eslint-disable-line\n }\n\n this.push({\n url: url,\n options: options,\n request: request,\n isUnmatched: true\n });\n\n if (this.fallbackResponse) {\n return {\n response: this.fallbackResponse\n };\n }\n\n if (!this.config.fallbackToNetwork) {\n var _context3;\n\n throw new Error((0, _concat[\"default\"])(_context3 = \"fetch-mock: No fallback response defined for \".concat(options && options.method || 'GET', \" to \")).call(_context3, url));\n }\n\n return {\n response: this.getNativeFetch()\n };\n};\n\nFetchMock.generateResponse =\n/*#__PURE__*/\nfunction () {\n var _ref2 = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regenerator[\"default\"].mark(function _callee2(route, url, options, request) {\n var response;\n return _regenerator[\"default\"].wrap(function _callee2$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return resolve(route.response, url, options, request);\n\n case 2:\n response = _context4.sent;\n\n if (!(response[\"throws\"] && typeof response !== 'function')) {\n _context4.next = 5;\n break;\n }\n\n throw response[\"throws\"];\n\n case 5:\n if (!this.config.Response.prototype.isPrototypeOf(response)) {\n _context4.next = 7;\n break;\n }\n\n return _context4.abrupt(\"return\", response);\n\n case 7:\n return _context4.abrupt(\"return\", responseBuilder({\n url: url,\n responseConfig: response,\n fetchMock: this,\n route: route\n }));\n\n case 8:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee2, this);\n }));\n\n return function (_x5, _x6, _x7, _x8) {\n return _ref2.apply(this, arguments);\n };\n}();\n\nFetchMock.router = function (url, options, request) {\n var _context5;\n\n var route = (0, _find[\"default\"])(_context5 = this.routes).call(_context5, function (route) {\n return route.matcher(url, options, request);\n });\n\n if (route) {\n this.push({\n url: url,\n options: options,\n request: request,\n identifier: route.identifier\n });\n return route;\n }\n};\n\nFetchMock.getNativeFetch = function () {\n var func = this.realFetch || this.isSandbox && this.config.fetch;\n\n if (!func) {\n throw new Error('fetch-mock: Falling back to network only available on gloabl fetch-mock, or by setting config.fetch on sandboxed fetch-mock');\n }\n\n return func;\n};\n\nFetchMock.push = function (_ref3) {\n var url = _ref3.url,\n options = _ref3.options,\n request = _ref3.request,\n isUnmatched = _ref3.isUnmatched,\n identifier = _ref3.identifier;\n var args = [url, options];\n args.request = request;\n args.identifier = identifier;\n args.isUnmatched = isUnmatched;\n\n this._calls.push(args);\n};\n\nmodule.exports = FetchMock;\n\n//# sourceURL=webpack://fetchMock/./es5/lib/fetch-handler.js?"); /***/ }), /***/ "./es5/lib/generate-matcher.js": /*!*************************************!*\ !*** ./es5/lib/generate-matcher.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n\nvar _filter = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/filter */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/filter.js\"));\n\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/defineProperty */ \"./node_modules/@babel/runtime-corejs3/helpers/defineProperty.js\"));\n\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/assign */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js\"));\n\nvar _reduce = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/reduce */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/reduce.js\"));\n\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/keys */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/keys.js\"));\n\nvar _every = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/every */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/every.js\"));\n\nvar _indexOf = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/index-of */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js\"));\n\nvar _glob = __webpack_require__(/*! glob-to-regexp */ \"./node_modules/glob-to-regexp/index.js\");\n\nvar pathToRegexp = __webpack_require__(/*! path-to-regexp */ \"./node_modules/path-to-regexp/index.js\");\n\nvar querystring = __webpack_require__(/*! querystring */ \"./node_modules/querystring-es3/index.js\");\n\nvar _require = __webpack_require__(/*! ./request-utils */ \"./es5/lib/request-utils.js\"),\n headerUtils = _require.headers,\n getPath = _require.getPath,\n getQuery = _require.getQuery,\n normalizeUrl = _require.normalizeUrl;\n\nvar stringMatchers = {\n begin: function begin(targetString) {\n return function (url) {\n return (0, _indexOf[\"default\"])(url).call(url, targetString) === 0;\n };\n },\n end: function end(targetString) {\n return function (url) {\n return url.substr(-targetString.length) === targetString;\n };\n },\n glob: function glob(targetString) {\n var urlRX = _glob(targetString);\n\n return function (url) {\n return urlRX.test(url);\n };\n },\n express: function express(targetString) {\n var urlRX = pathToRegexp(targetString);\n return function (url) {\n return urlRX.test(getPath(url));\n };\n },\n path: function path(targetString) {\n return function (url) {\n return getPath(url) === targetString;\n };\n }\n};\n\nvar getHeaderMatcher = function getHeaderMatcher(_ref) {\n var expectedHeaders = _ref.headers;\n var expectation = headerUtils.toLowerCase(expectedHeaders);\n return function (url, _ref2) {\n var _context;\n\n var _ref2$headers = _ref2.headers,\n headers = _ref2$headers === void 0 ? {} : _ref2$headers;\n var lowerCaseHeaders = headerUtils.toLowerCase(headerUtils.normalize(headers));\n return (0, _every[\"default\"])(_context = (0, _keys[\"default\"])(expectation)).call(_context, function (headerName) {\n return headerUtils.equal(lowerCaseHeaders[headerName], expectation[headerName]);\n });\n };\n};\n\nvar getMethodMatcher = function getMethodMatcher(_ref3) {\n var expectedMethod = _ref3.method;\n return function (url, _ref4) {\n var method = _ref4.method;\n return expectedMethod === (method ? method.toLowerCase() : 'get');\n };\n};\n\nvar getQueryStringMatcher = function getQueryStringMatcher(_ref5) {\n var expectedQuery = _ref5.query;\n var keys = (0, _keys[\"default\"])(expectedQuery);\n return function (url) {\n var query = querystring.parse(getQuery(url));\n return (0, _every[\"default\"])(keys).call(keys, function (key) {\n return query[key] === expectedQuery[key];\n });\n };\n};\n\nvar getParamsMatcher = function getParamsMatcher(_ref6) {\n var expectedParams = _ref6.params,\n matcher = _ref6.matcher;\n\n if (!/express:/.test(matcher)) {\n throw new Error('fetch-mock: matching on params is only possible when using an express: matcher');\n }\n\n var expectedKeys = (0, _keys[\"default\"])(expectedParams);\n var keys = [];\n var re = pathToRegexp(matcher.replace(/^express:/, ''), keys);\n return function (url) {\n var vals = re.exec(getPath(url)) || [];\n vals.shift();\n var params = (0, _reduce[\"default\"])(keys).call(keys, function (map, _ref7, i) {\n var name = _ref7.name;\n return vals[i] ? (0, _assign[\"default\"])(map, (0, _defineProperty2[\"default\"])({}, name, vals[i])) : map;\n }, {});\n return (0, _every[\"default\"])(expectedKeys).call(expectedKeys, function (key) {\n return params[key] === expectedParams[key];\n });\n };\n};\n\nvar getFunctionMatcher = function getFunctionMatcher(_ref8) {\n var matcher = _ref8.matcher,\n _ref8$functionMatcher = _ref8.functionMatcher,\n functionMatcher = _ref8$functionMatcher === void 0 ? function () {\n return true;\n } : _ref8$functionMatcher;\n return typeof matcher === 'function' ? matcher : functionMatcher;\n};\n\nvar getUrlMatcher = function getUrlMatcher(route) {\n var matcher = route.matcher,\n query = route.query;\n\n if (typeof matcher === 'function') {\n return function () {\n return true;\n };\n }\n\n if (matcher instanceof RegExp) {\n return function (url) {\n return matcher.test(url);\n };\n }\n\n if (matcher === '*') {\n return function () {\n return true;\n };\n }\n\n for (var shorthand in stringMatchers) {\n if ((0, _indexOf[\"default\"])(matcher).call(matcher, shorthand + ':') === 0) {\n var url = matcher.replace(new RegExp(\"^\".concat(shorthand, \":\")), '');\n return stringMatchers[shorthand](url);\n }\n } // if none of the special syntaxes apply, it's just a simple string match\n // but we have to be careful to normalize the url we check and the name\n // of the route to allow for e.g. http://it.at.there being indistinguishable\n // from http://it.at.there/ once we start generating Request/Url objects\n\n\n var expectedUrl = normalizeUrl(matcher);\n\n if (route.identifier === matcher) {\n route.identifier = expectedUrl;\n }\n\n return function (url) {\n if (query && (0, _indexOf[\"default\"])(expectedUrl).call(expectedUrl, '?')) {\n return (0, _indexOf[\"default\"])(url).call(url, expectedUrl) === 0;\n }\n\n return normalizeUrl(url) === expectedUrl;\n };\n};\n\nmodule.exports = function (route) {\n var _context2;\n\n var matchers = (0, _filter[\"default\"])(_context2 = [route.query && getQueryStringMatcher(route), route.method && getMethodMatcher(route), route.headers && getHeaderMatcher(route), route.params && getParamsMatcher(route), getFunctionMatcher(route), getUrlMatcher(route)]).call(_context2, function (matcher) {\n return !!matcher;\n });\n return function (url) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var request = arguments.length > 2 ? arguments[2] : undefined;\n return (0, _every[\"default\"])(matchers).call(matchers, function (matcher) {\n return matcher(url, options, request);\n });\n };\n};\n\n//# sourceURL=webpack://fetchMock/./es5/lib/generate-matcher.js?"); /***/ }), /***/ "./es5/lib/index.js": /*!**************************!*\ !*** ./es5/lib/index.js ***! \**************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n\nvar _bind = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/bind */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/bind.js\"));\n\nvar _map = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/map */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/map.js\"));\n\nvar _slice = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/slice */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/slice.js\"));\n\nvar _create = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/create */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/create.js\"));\n\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/assign */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js\"));\n\nvar setUpAndTearDown = __webpack_require__(/*! ./set-up-and-tear-down */ \"./es5/lib/set-up-and-tear-down.js\");\n\nvar fetchHandler = __webpack_require__(/*! ./fetch-handler */ \"./es5/lib/fetch-handler.js\");\n\nvar inspecting = __webpack_require__(/*! ./inspecting */ \"./es5/lib/inspecting.js\");\n\nvar FetchMock = (0, _assign[\"default\"])({}, fetchHandler, setUpAndTearDown, inspecting);\nFetchMock.config = {\n fallbackToNetwork: false,\n includeContentLength: true,\n sendAsJson: true,\n warnOnFallback: true,\n overwriteRoutes: undefined\n};\n\nFetchMock.createInstance = function (isLibrary) {\n var _context, _context2;\n\n var instance = (0, _create[\"default\"])(FetchMock);\n instance._uncompiledRoutes = (0, _slice[\"default\"])(_context = this._uncompiledRoutes || []).call(_context);\n instance.routes = (0, _map[\"default\"])(_context2 = instance._uncompiledRoutes).call(_context2, function (config) {\n return instance.compileRoute(config);\n });\n instance.fallbackResponse = this.fallbackResponse || undefined;\n instance.config = (0, _assign[\"default\"])({}, this.config || FetchMock.config);\n instance._calls = [];\n instance._holdingPromises = [];\n instance.bindMethods();\n\n if (isLibrary) {\n (0, _assign[\"default\"])(instance, {\n MATCHED: true,\n UNMATCHED: false,\n fetchMock: instance\n });\n }\n\n return instance;\n};\n\nFetchMock.bindMethods = function () {\n var _context3, _context4, _context5, _context6;\n\n this.fetchHandler = (0, _bind[\"default\"])(_context3 = FetchMock.fetchHandler).call(_context3, this);\n this.reset = this.restore = (0, _bind[\"default\"])(_context4 = FetchMock.reset).call(_context4, this);\n this.resetHistory = (0, _bind[\"default\"])(_context5 = FetchMock.resetHistory).call(_context5, this);\n this.resetBehavior = (0, _bind[\"default\"])(_context6 = FetchMock.resetBehavior).call(_context6, this);\n};\n\nFetchMock.sandbox = function () {\n // this construct allows us to create a fetch-mock instance which is also\n // a callable function, while circumventing circularity when defining the\n // object that this function should be bound to\n var proxy = function proxy(url, options) {\n return sandbox.fetchHandler(url, options);\n };\n\n var sandbox = (0, _assign[\"default\"])(proxy, // Ensures that the entire returned object is a callable function\n FetchMock, // prototype methods\n this.createInstance() // instance data\n );\n sandbox.bindMethods();\n sandbox.isSandbox = true;\n return sandbox;\n};\n\nmodule.exports = FetchMock;\n\n//# sourceURL=webpack://fetchMock/./es5/lib/index.js?"); /***/ }), /***/ "./es5/lib/inspecting.js": /*!*******************************!*\ !*** ./es5/lib/inspecting.js ***! \*******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n\nvar _concat = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/concat */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js\"));\n\nvar _find = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/find */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/find.js\"));\n\nvar _repeat = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/repeat */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/repeat.js\"));\n\nvar _map = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/map */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/map.js\"));\n\nvar _every = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/every */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/every.js\"));\n\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/promise */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/promise.js\"));\n\nvar _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/toConsumableArray */ \"./node_modules/@babel/runtime-corejs3/helpers/toConsumableArray.js\"));\n\nvar _some = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/some */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/some.js\"));\n\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/slicedToArray */ \"./node_modules/@babel/runtime-corejs3/helpers/slicedToArray.js\"));\n\nvar _filter = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/filter */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/filter.js\"));\n\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/assign */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js\"));\n\nvar _require = __webpack_require__(/*! ./request-utils */ \"./es5/lib/request-utils.js\"),\n normalizeUrl = _require.normalizeUrl;\n\nvar FetchMock = {};\n\nvar _require2 = __webpack_require__(/*! ./compile-route */ \"./es5/lib/compile-route.js\"),\n sanitizeRoute = _require2.sanitizeRoute;\n\nvar generateMatcher = __webpack_require__(/*! ./generate-matcher */ \"./es5/lib/generate-matcher.js\");\n\nvar isName = function isName(nameOrMatcher) {\n return typeof nameOrMatcher === 'string' && /^[\\da-zA-Z\\-]+$/.test(nameOrMatcher);\n};\n\nvar filterCallsWithMatcher = function filterCallsWithMatcher(matcher) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var calls = arguments.length > 2 ? arguments[2] : undefined;\n matcher = generateMatcher(sanitizeRoute((0, _assign[\"default\"])({\n matcher: matcher\n }, options)));\n return (0, _filter[\"default\"])(calls).call(calls, function (_ref) {\n var _ref2 = (0, _slicedToArray2[\"default\"])(_ref, 2),\n url = _ref2[0],\n options = _ref2[1];\n\n return matcher(normalizeUrl(url), options);\n });\n};\n\nFetchMock.filterCalls = function (nameOrMatcher, options) {\n var calls = this._calls;\n var matcher = '*';\n\n if (nameOrMatcher === true) {\n calls = (0, _filter[\"default\"])(calls).call(calls, function (_ref3) {\n var isUnmatched = _ref3.isUnmatched;\n return !isUnmatched;\n });\n } else if (nameOrMatcher === false) {\n calls = (0, _filter[\"default\"])(calls).call(calls, function (_ref4) {\n var isUnmatched = _ref4.isUnmatched;\n return isUnmatched;\n });\n } else if (typeof nameOrMatcher === 'undefined') {\n calls = calls;\n } else if (isName(nameOrMatcher)) {\n calls = (0, _filter[\"default\"])(calls).call(calls, function (_ref5) {\n var identifier = _ref5.identifier;\n return identifier === nameOrMatcher;\n });\n } else {\n var _context;\n\n matcher = normalizeUrl(nameOrMatcher);\n\n if ((0, _some[\"default\"])(_context = this.routes).call(_context, function (_ref6) {\n var identifier = _ref6.identifier;\n return identifier === matcher;\n })) {\n calls = (0, _filter[\"default\"])(calls).call(calls, function (call) {\n return call.identifier === matcher;\n });\n }\n }\n\n if ((options || matcher !== '*') && calls.length) {\n if (typeof options === 'string') {\n options = {\n method: options\n };\n }\n\n calls = filterCallsWithMatcher(matcher, options, calls);\n }\n\n return calls;\n};\n\nFetchMock.calls = function (nameOrMatcher, options) {\n return this.filterCalls(nameOrMatcher, options);\n};\n\nFetchMock.lastCall = function (nameOrMatcher, options) {\n return (0, _toConsumableArray2[\"default\"])(this.filterCalls(nameOrMatcher, options)).pop();\n};\n\nFetchMock.lastUrl = function (nameOrMatcher, options) {\n return (this.lastCall(nameOrMatcher, options) || [])[0];\n};\n\nFetchMock.lastOptions = function (nameOrMatcher, options) {\n return (this.lastCall(nameOrMatcher, options) || [])[1];\n};\n\nFetchMock.called = function (nameOrMatcher, options) {\n return !!this.filterCalls(nameOrMatcher, options).length;\n};\n\nFetchMock.flush = function (waitForResponseMethods) {\n var _this = this;\n\n var queuedPromises = this._holdingPromises;\n this._holdingPromises = [];\n return _promise[\"default\"].all(queuedPromises).then(function () {\n if (waitForResponseMethods && _this._holdingPromises.length) {\n return _this.flush(waitForResponseMethods);\n }\n });\n};\n\nFetchMock.done = function (nameOrMatcher) {\n var _context2,\n _this2 = this;\n\n var routesToCheck = nameOrMatcher && typeof nameOrMatcher !== 'boolean' ? [{\n identifier: nameOrMatcher\n }] : this.routes; // Can't use array.every because would exit after first failure, which would\n // break the logging\n\n return (0, _every[\"default\"])(_context2 = (0, _map[\"default\"])(routesToCheck).call(routesToCheck, function (_ref7) {\n var _context3;\n\n var identifier = _ref7.identifier;\n\n if (!_this2.called(identifier)) {\n console.warn(\"Warning: \".concat(identifier, \" not called\")); // eslint-disable-line\n\n return false;\n }\n\n var expectedTimes = (0, _repeat[\"default\"])((0, _find[\"default\"])(_context3 = _this2.routes).call(_context3, function (r) {\n return r.identifier === identifier;\n }) || {});\n\n if (!expectedTimes) {\n return true;\n }\n\n var actualTimes = _this2.filterCalls(identifier).length;\n\n if (expectedTimes > actualTimes) {\n var _context4, _context5;\n\n console.warn((0, _concat[\"default\"])(_context4 = (0, _concat[\"default\"])(_context5 = \"Warning: \".concat(identifier, \" only called \")).call(_context5, actualTimes, \" times, but \")).call(_context4, expectedTimes, \" expected\")); // eslint-disable-line\n\n return false;\n } else {\n return true;\n }\n })).call(_context2, function (isDone) {\n return isDone;\n });\n};\n\nmodule.exports = FetchMock;\n\n//# sourceURL=webpack://fetchMock/./es5/lib/inspecting.js?"); /***/ }), /***/ "./es5/lib/request-utils.js": /*!**********************************!*\ !*** ./es5/lib/request-utils.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n\nvar _every = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/every */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/every.js\"));\n\nvar _isArray = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/array/is-array */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/array/is-array.js\"));\n\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/keys */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/keys.js\"));\n\nvar _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/typeof */ \"./node_modules/@babel/runtime-corejs3/helpers/typeof.js\"));\n\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/defineProperty */ \"./node_modules/@babel/runtime-corejs3/helpers/defineProperty.js\"));\n\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/assign */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js\"));\n\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/slicedToArray */ \"./node_modules/@babel/runtime-corejs3/helpers/slicedToArray.js\"));\n\nvar _reduce = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/reduce */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/reduce.js\"));\n\nvar _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/toConsumableArray */ \"./node_modules/@babel/runtime-corejs3/helpers/toConsumableArray.js\"));\n\nvar _getIteratorMethod2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js/get-iterator-method */ \"./node_modules/@babel/runtime-corejs3/core-js/get-iterator-method.js\"));\n\nvar _entries = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/entries */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/entries.js\"));\n\nvar URL = __webpack_require__(/*! whatwg-url */ \"./node_modules/whatwg-url/lib/public-api.js\"); // https://stackoverflow.com/a/19709846/308237\n\n\nvar absoluteUrlRX = new RegExp('^(?:[a-z]+:)?//', 'i');\n\nvar headersToArray = function headersToArray(headers) {\n // node-fetch 1 Headers\n if (typeof headers.raw === 'function') {\n return (0, _entries[\"default\"])(headers.raw());\n } else if ((0, _getIteratorMethod2[\"default\"])(headers)) {\n return (0, _toConsumableArray2[\"default\"])(headers);\n } else {\n return (0, _entries[\"default\"])(headers);\n }\n};\n\nvar zipObject = function zipObject(entries) {\n return (0, _reduce[\"default\"])(entries).call(entries, function (obj, _ref) {\n var _ref2 = (0, _slicedToArray2[\"default\"])(_ref, 2),\n key = _ref2[0],\n val = _ref2[1];\n\n return (0, _assign[\"default\"])(obj, (0, _defineProperty2[\"default\"])({}, key, val));\n }, {});\n};\n\nvar normalizeUrl = function normalizeUrl(url) {\n if (typeof url === 'function' || url instanceof RegExp || /^(begin|end|glob|express|path)\\:/.test(url)) {\n return url;\n }\n\n if (absoluteUrlRX.test(url)) {\n var u = new URL.URL(url);\n return u.href;\n } else {\n var _u = new URL.URL(url, 'http://dummy');\n\n return _u.pathname + _u.search;\n }\n};\n\nmodule.exports = {\n normalizeRequest: function normalizeRequest(url, options, Request) {\n if (Request.prototype.isPrototypeOf(url)) {\n var obj = {\n url: normalizeUrl(url.url),\n options: (0, _assign[\"default\"])({\n method: url.method\n }, options),\n request: url\n };\n var headers = headersToArray(url.headers);\n\n if (headers.length) {\n obj.options.headers = zipObject(headers);\n }\n\n return obj;\n } else if (typeof url === 'string' || // horrible URL object duck-typing\n (0, _typeof2[\"default\"])(url) === 'object' && 'href' in url) {\n return {\n url: normalizeUrl(url),\n options: options\n };\n } else if ((0, _typeof2[\"default\"])(url) === 'object') {\n throw new TypeError('fetch-mock: Unrecognised Request object. Read the Config and Installation sections of the docs');\n } else {\n throw new TypeError('fetch-mock: Invalid arguments passed to fetch');\n }\n },\n normalizeUrl: normalizeUrl,\n getPath: function getPath(url) {\n var u = absoluteUrlRX.test(url) ? new URL.URL(url) : new URL.URL(url, 'http://dummy');\n return u.pathname;\n },\n getQuery: function getQuery(url) {\n var u = absoluteUrlRX.test(url) ? new URL.URL(url) : new URL.URL(url, 'http://dummy');\n return u.search ? u.search.substr(1) : '';\n },\n headers: {\n normalize: function normalize(headers) {\n return zipObject(headersToArray(headers));\n },\n toLowerCase: function toLowerCase(headers) {\n var _context;\n\n return (0, _reduce[\"default\"])(_context = (0, _keys[\"default\"])(headers)).call(_context, function (obj, k) {\n obj[k.toLowerCase()] = headers[k];\n return obj;\n }, {});\n },\n equal: function equal(actualHeader, expectedHeader) {\n actualHeader = (0, _isArray[\"default\"])(actualHeader) ? actualHeader : [actualHeader];\n expectedHeader = (0, _isArray[\"default\"])(expectedHeader) ? expectedHeader : [expectedHeader];\n\n if (actualHeader.length !== expectedHeader.length) {\n return false;\n }\n\n return (0, _every[\"default\"])(actualHeader).call(actualHeader, function (val, i) {\n return val === expectedHeader[i];\n });\n }\n }\n};\n\n//# sourceURL=webpack://fetchMock/./es5/lib/request-utils.js?"); /***/ }), /***/ "./es5/lib/response-builder.js": /*!*************************************!*\ !*** ./es5/lib/response-builder.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n\nvar _stringify = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/json/stringify */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/json/stringify.js\"));\n\nvar _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/typeof */ \"./node_modules/@babel/runtime-corejs3/helpers/typeof.js\"));\n\nvar _parseInt2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/parse-int */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/parse-int.js\"));\n\nvar _includes = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/includes */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/includes.js\"));\n\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/keys */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/keys.js\"));\n\nvar _every = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/every */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/every.js\"));\n\nvar _some = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/some */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/instance/some.js\"));\n\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/assign */ \"./node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js\"));\n\nvar _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/classCallCheck */ \"./node_modules/@babel/runtime-corejs3/helpers/classCallCheck.js\"));\n\nvar _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/createClass */ \"./node_modules/@babel/runtime-corejs3/helpers/createClass.js\"));\n\nvar responseConfigProps = ['body', 'headers', 'throws', 'status', 'redirectUrl'];\n\nvar ResponseBuilder =\n/*#__PURE__*/\nfunction () {\n function ResponseBuilder(options) {\n (0, _classCallCheck2[\"default\"])(this, ResponseBuilder);\n (0, _assign[\"default\"])(this, options);\n }\n\n (0, _createClass2[\"default\"])(ResponseBuilder, [{\n key: \"exec\",\n value: function exec() {\n this.normalizeResponseConfig();\n this.constructFetchOpts();\n this.constructResponseBody();\n return this.buildObservableResponse(new this.fetchMock.config.Response(this.body, this.options));\n }\n }, {\n key: \"sendAsObject\",\n value: function sendAsObject() {\n var _this = this;\n\n if ((0, _some[\"default\"])(responseConfigProps).call(responseConfigProps, function (prop) {\n return _this.responseConfig[prop];\n })) {\n var _context;\n\n if ((0, _every[\"default\"])(_context = (0, _keys[\"default\"])(this.responseConfig)).call(_context, function (key) {\n return (0, _includes[\"default\"])(responseConfigProps).call(responseConfigProps, key);\n })) {\n return false;\n } else {\n return true;\n }\n } else {\n return true;\n }\n }\n }, {\n key: \"normalizeResponseConfig\",\n value: function normalizeResponseConfig() {\n // If the response config looks like a status, start to generate a simple response\n if (typeof this.responseConfig === 'number') {\n this.responseConfig = {\n status: this.responseConfig\n }; // If the response config is not an object, or is an object that doesn't use\n // any reserved properties, assume it is meant to be the body of the response\n } else if (typeof this.responseConfig === 'string' || this.sendAsObject()) {\n this.responseConfig = {\n body: this.responseConfig\n };\n }\n }\n }, {\n key: \"validateStatus\",\n value: function validateStatus(status) {\n if (!status) {\n return 200;\n }\n\n if (typeof status === 'number' && (0, _parseInt2[\"default\"])(status, 10) !== status && status >= 200 || status < 600) {\n return status;\n }\n\n throw new TypeError(\"fetch-mock: Invalid status \".concat(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\\\"}}\"));\n }\n }, {\n key: \"constructFetchOpts\",\n value: function constructFetchOpts() {\n this.options = this.responseConfig.options || {};\n this.options.url = this.responseConfig.redirectUrl || this.url;\n this.options.status = this.validateStatus(this.responseConfig.status);\n this.options.statusText = this.fetchMock.statusTextMap['' + this.options.status]; // Set up response headers. The empty object is to cope with\n // new Headers(undefined) throwing in Chrome\n // https://code.google.com/p/chromium/issues/detail?id=335871\n\n this.options.headers = new this.fetchMock.config.Headers(this.responseConfig.headers || {});\n }\n }, {\n key: \"getOption\",\n value: function getOption(name) {\n return name in this.route ? this.route[name] : this.fetchMock.config[name];\n }\n }, {\n key: \"convertToJson\",\n value: function convertToJson() {\n // convert to json if we need to\n if (this.getOption('sendAsJson') && this.responseConfig.body != null && //eslint-disable-line\n (0, _typeof2[\"default\"])(this.body) === 'object') {\n this.body = (0, _stringify[\"default\"])(this.body);\n\n if (!this.options.headers.has('Content-Type')) {\n this.options.headers.set('Content-Type', 'application/json');\n }\n }\n }\n }, {\n key: \"setContentLength\",\n value: function setContentLength() {\n // add a Content-Length header if we need to\n if (this.getOption('includeContentLength') && typeof this.body === 'string' && !this.options.headers.has('Content-Length')) {\n this.options.headers.set('Content-Length', this.body.length.toString());\n }\n }\n }, {\n key: \"constructResponseBody\",\n value: function constructResponseBody() {\n // start to construct the body\n this.body = this.responseConfig.body;\n this.convertToJson();\n this.setContentLength(); // On the server we need to manually construct the readable stream for the\n // Response object (on the client this done automatically)\n\n if (this.Stream) {\n var stream = new this.Stream.Readable();\n\n if (this.body != null) {\n //eslint-disable-line\n stream.push(this.body, 'utf-8');\n }\n\n stream.push(null);\n this.body = stream;\n }\n\n this.body = this.body;\n }\n }, {\n key: \"buildObservableResponse\",\n value: function buildObservableResponse(response) {\n var _this2 = this;\n\n var fetchMock = this.fetchMock; // Using a proxy means we can set properties that may not be writable on\n // the original Response. It also means we can track the resolution of\n // promises returned by res.json(), res.text() etc\n\n return new Proxy(response, {\n get: function get(originalResponse, name) {\n if (_this2.responseConfig.redirectUrl) {\n if (name === 'url') {\n return _this2.responseConfig.redirectUrl;\n }\n\n if (name === 'redirected') {\n return true;\n }\n }\n\n if (typeof originalResponse[name] === 'function') {\n return new Proxy(originalResponse[name], {\n apply: function apply(func, thisArg, args) {\n var result = func.apply(response, args);\n\n if (result.then) {\n fetchMock._holdingPromises.push(result[\"catch\"](function () {\n return null;\n }));\n }\n\n return result;\n }\n });\n }\n\n return originalResponse[name];\n }\n });\n }\n }]);\n return ResponseBuilder;\n}();\n\nmodule.exports = function (options) {\n return new ResponseBuilder(options).exec();\n};\n\n//# sourceURL=webpack://fetchMock/./es5/lib/response-builder.js?"); /***/ }), /***/ "./es5/lib/set-up-and-tear-down.js": /*!*****************************************!*\ !*** ./es5/lib/set-up-and-tear-down.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDe