mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 16:35:14 +00:00
1 line
6.1 KiB
JSON
1 line
6.1 KiB
JSON
{"ast":null,"code":"'use strict';\n\nvar utils = require('./../utils');\n\nvar transformData = require('./transformData');\n\nvar isCancel = require('../cancel/isCancel');\n\nvar defaults = require('../defaults');\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\n\n\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\n\n\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config); // Ensure headers exist\n\n config.headers = config.headers || {}; // Transform request data\n\n config.data = transformData(config.data, config.headers, config.transformRequest); // Flatten headers\n\n config.headers = utils.merge(config.headers.common || {}, config.headers[config.method] || {}, config.headers);\n utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) {\n delete config.headers[method];\n });\n var adapter = config.adapter || defaults.adapter;\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config); // Transform response data\n\n response.data = transformData(response.data, response.headers, config.transformResponse);\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config); // Transform response data\n\n if (reason && reason.response) {\n reason.response.data = transformData(reason.response.data, reason.response.headers, config.transformResponse);\n }\n }\n\n return Promise.reject(reason);\n });\n};","map":{"version":3,"sources":["/app/node_modules/axios/lib/core/dispatchRequest.js"],"names":["utils","require","transformData","isCancel","defaults","throwIfCancellationRequested","config","cancelToken","throwIfRequested","module","exports","dispatchRequest","headers","data","transformRequest","merge","common","method","forEach","cleanHeaderConfig","adapter","then","onAdapterResolution","response","transformResponse","onAdapterRejection","reason","Promise","reject"],"mappings":"AAAA;;AAEA,IAAIA,KAAK,GAAGC,OAAO,CAAC,YAAD,CAAnB;;AACA,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AEA,SAAOA,OAAO,CAACd,MAAD,CAAP,CAAgBe,IAAhB,CAAqB,SAASC,mBAAT,CAA6BC,QAA7B,EAAuC;AACjElB,IAAAA,4BAA4B,CAACC,MAAD,CAA5B,CADiE,CAGjE;;AACAiB,IAAAA,QAAQ,CAACV,IAAT,GAAgBX,aAAa,CAC3BqB,QAAQ,CAACV,IADkB,EAE3BU,QAAQ,CAACX,OAFkB,EAG3BN,MAAM,CAACkB,iBAHoB,CAA7B;AAMA,WAAOD,QAAP;AACD,GAXM,EAWJ,SAASE,kBAAT,CAA4BC,MAA5B,EAAoC;AACrC,QAAI,CAACvB,QAAQ,CAACuB,MAAD,CAAb,EAAuB;AACrBrB,MAAAA,4BAA4B,CAACC,MAAD,CAA5B,CADqB,CAGrB;;AACA,UAAIoB,MAAM,IAAIA,MAAM,CAACH,QAArB,EAA+B;AAC7BG,QAAAA,MAAM,CAACH,QAAP,CAAgBV,IAAhB,GAAuBX,aAAa,CAClCwB,MAAM,CAACH,QAAP,CAAgBV,IADkB,EAElCa,MAAM,CAACH,QAAP,CAAgBX,OAFkB,EAGlCN,MAAM,CAACkB,iBAH2B,CAApC;AAKD;AACF;;AAED,WAAOG,OAAO,CAACC,MAAR,CAAeF,MAAf,CAAP;AACD,GA1BM,CAAP;AA2BD,CAxDD","sourcesContent":["'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n"]},"metadata":{},"sourceType":"script"} |