mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Releasing 0.15.0
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"main": "./dist/axios.js",
|
"main": "./dist/axios.js",
|
||||||
"version": "0.14.0",
|
"version": "0.15.0",
|
||||||
"homepage": "https://github.com/mzabriskie/axios",
|
"homepage": "https://github.com/mzabriskie/axios",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Matt Zabriskie"
|
"Matt Zabriskie"
|
||||||
|
|||||||
Vendored
+336
-197
@@ -1,14 +1,14 @@
|
|||||||
/* axios v0.14.0 | (c) 2016 by Matt Zabriskie */
|
/* axios v0.15.0 | (c) 2016 by Matt Zabriskie */
|
||||||
(function webpackUniversalModuleDefinition(root, factory) {
|
(function webpackUniversalModuleDefinition(root, factory) {
|
||||||
if(typeof exports === 'object' && typeof module === 'object')
|
if(typeof exports === 'object' && typeof module === 'object')
|
||||||
module.exports = factory();
|
module.exports = factory(require("undefined"));
|
||||||
else if(typeof define === 'function' && define.amd)
|
else if(typeof define === 'function' && define.amd)
|
||||||
define([], factory);
|
define(["undefined"], factory);
|
||||||
else if(typeof exports === 'object')
|
else if(typeof exports === 'object')
|
||||||
exports["axios"] = factory();
|
exports["axios"] = factory(require("undefined"));
|
||||||
else
|
else
|
||||||
root["axios"] = factory();
|
root["axios"] = factory(root["undefined"]);
|
||||||
})(this, function() {
|
})(this, function(__WEBPACK_EXTERNAL_MODULE_16__) {
|
||||||
return /******/ (function(modules) { // webpackBootstrap
|
return /******/ (function(modules) { // webpackBootstrap
|
||||||
/******/ // The module cache
|
/******/ // The module cache
|
||||||
/******/ var installedModules = {};
|
/******/ var installedModules = {};
|
||||||
@@ -97,11 +97,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
return createInstance(defaultConfig);
|
return createInstance(defaultConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Expose Cancel & CancelToken
|
||||||
|
axios.Cancel = __webpack_require__(23);
|
||||||
|
axios.CancelToken = __webpack_require__(24);
|
||||||
|
axios.isCancel = __webpack_require__(20);
|
||||||
|
|
||||||
// Expose all/spread
|
// Expose all/spread
|
||||||
axios.all = function all(promises) {
|
axios.all = function all(promises) {
|
||||||
return Promise.all(promises);
|
return Promise.all(promises);
|
||||||
};
|
};
|
||||||
axios.spread = __webpack_require__(21);
|
axios.spread = __webpack_require__(25);
|
||||||
|
|
||||||
module.exports = axios;
|
module.exports = axios;
|
||||||
|
|
||||||
@@ -332,7 +337,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
} else {
|
} else {
|
||||||
// Iterate over object keys
|
// Iterate over object keys
|
||||||
for (var key in obj) {
|
for (var key in obj) {
|
||||||
if (obj.hasOwnProperty(key)) {
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||||
fn.call(null, obj[key], key, obj);
|
fn.call(null, obj[key], key, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,10 +444,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
var defaults = __webpack_require__(5);
|
var defaults = __webpack_require__(5);
|
||||||
var utils = __webpack_require__(2);
|
var utils = __webpack_require__(2);
|
||||||
var InterceptorManager = __webpack_require__(7);
|
var InterceptorManager = __webpack_require__(17);
|
||||||
var dispatchRequest = __webpack_require__(8);
|
var dispatchRequest = __webpack_require__(18);
|
||||||
var isAbsoluteURL = __webpack_require__(19);
|
var isAbsoluteURL = __webpack_require__(21);
|
||||||
var combineURLs = __webpack_require__(20);
|
var combineURLs = __webpack_require__(22);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance of Axios
|
* Create a new instance of Axios
|
||||||
@@ -542,7 +547,21 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDefaultAdapter() {
|
||||||
|
var adapter;
|
||||||
|
if (typeof XMLHttpRequest !== 'undefined') {
|
||||||
|
// For browsers use XHR adapter
|
||||||
|
adapter = __webpack_require__(7);
|
||||||
|
} else if (typeof process !== 'undefined') {
|
||||||
|
// For node use HTTP adapter
|
||||||
|
adapter = __webpack_require__(16);
|
||||||
|
}
|
||||||
|
return adapter;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
adapter: getDefaultAdapter(),
|
||||||
|
|
||||||
transformRequest: [function transformRequest(data, headers) {
|
transformRequest: [function transformRequest(data, headers) {
|
||||||
normalizeHeaderName(headers, 'Content-Type');
|
normalizeHeaderName(headers, 'Content-Type');
|
||||||
if (utils.isFormData(data) ||
|
if (utils.isFormData(data) ||
|
||||||
@@ -625,177 +644,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var utils = __webpack_require__(2);
|
var utils = __webpack_require__(2);
|
||||||
|
var settle = __webpack_require__(8);
|
||||||
function InterceptorManager() {
|
var buildURL = __webpack_require__(11);
|
||||||
this.handlers = [];
|
var parseHeaders = __webpack_require__(12);
|
||||||
}
|
var isURLSameOrigin = __webpack_require__(13);
|
||||||
|
var createError = __webpack_require__(9);
|
||||||
/**
|
var btoa = (typeof window !== 'undefined' && window.btoa) || __webpack_require__(14);
|
||||||
* Add a new interceptor to the stack
|
|
||||||
*
|
|
||||||
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
||||||
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
||||||
*
|
|
||||||
* @return {Number} An ID used to remove interceptor later
|
|
||||||
*/
|
|
||||||
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
|
||||||
this.handlers.push({
|
|
||||||
fulfilled: fulfilled,
|
|
||||||
rejected: rejected
|
|
||||||
});
|
|
||||||
return this.handlers.length - 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove an interceptor from the stack
|
|
||||||
*
|
|
||||||
* @param {Number} id The ID that was returned by `use`
|
|
||||||
*/
|
|
||||||
InterceptorManager.prototype.eject = function eject(id) {
|
|
||||||
if (this.handlers[id]) {
|
|
||||||
this.handlers[id] = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterate over all the registered interceptors
|
|
||||||
*
|
|
||||||
* This method is particularly useful for skipping over any
|
|
||||||
* interceptors that may have become `null` calling `eject`.
|
|
||||||
*
|
|
||||||
* @param {Function} fn The function to call for each interceptor
|
|
||||||
*/
|
|
||||||
InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
||||||
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
||||||
if (h !== null) {
|
|
||||||
fn(h);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = InterceptorManager;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
|
||||||
/* 8 */
|
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = __webpack_require__(2);
|
|
||||||
var transformData = __webpack_require__(9);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatch a request to the server using whichever adapter
|
|
||||||
* is supported by the current environment.
|
|
||||||
*
|
|
||||||
* @param {object} config The config that is to be used for the request
|
|
||||||
* @returns {Promise} The Promise to be fulfilled
|
|
||||||
*/
|
|
||||||
module.exports = function dispatchRequest(config) {
|
|
||||||
// Ensure headers exist
|
|
||||||
config.headers = config.headers || {};
|
|
||||||
|
|
||||||
// Transform request data
|
|
||||||
config.data = transformData(
|
|
||||||
config.data,
|
|
||||||
config.headers,
|
|
||||||
config.transformRequest
|
|
||||||
);
|
|
||||||
|
|
||||||
// Flatten headers
|
|
||||||
config.headers = utils.merge(
|
|
||||||
config.headers.common || {},
|
|
||||||
config.headers[config.method] || {},
|
|
||||||
config.headers || {}
|
|
||||||
);
|
|
||||||
|
|
||||||
utils.forEach(
|
|
||||||
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
||||||
function cleanHeaderConfig(method) {
|
|
||||||
delete config.headers[method];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
var adapter;
|
|
||||||
|
|
||||||
if (typeof config.adapter === 'function') {
|
|
||||||
// For custom adapter support
|
|
||||||
adapter = config.adapter;
|
|
||||||
} else if (typeof XMLHttpRequest !== 'undefined') {
|
|
||||||
// For browsers use XHR adapter
|
|
||||||
adapter = __webpack_require__(10);
|
|
||||||
} else if (typeof process !== 'undefined') {
|
|
||||||
// For node use HTTP adapter
|
|
||||||
adapter = __webpack_require__(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.resolve(config)
|
|
||||||
// Wrap synchronous adapter errors and pass configuration
|
|
||||||
.then(adapter)
|
|
||||||
.then(function onFulfilled(response) {
|
|
||||||
// Transform response data
|
|
||||||
response.data = transformData(
|
|
||||||
response.data,
|
|
||||||
response.headers,
|
|
||||||
config.transformResponse
|
|
||||||
);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}, function onRejected(error) {
|
|
||||||
// Transform response data
|
|
||||||
if (error && error.response) {
|
|
||||||
error.response.data = transformData(
|
|
||||||
error.response.data,
|
|
||||||
error.response.headers,
|
|
||||||
config.transformResponse
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.reject(error);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
|
||||||
/* 9 */
|
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = __webpack_require__(2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transform the data for a request or a response
|
|
||||||
*
|
|
||||||
* @param {Object|String} data The data to be transformed
|
|
||||||
* @param {Array} headers The headers for the request or response
|
|
||||||
* @param {Array|Function} fns A single function or Array of functions
|
|
||||||
* @returns {*} The resulting transformed data
|
|
||||||
*/
|
|
||||||
module.exports = function transformData(data, headers, fns) {
|
|
||||||
/*eslint no-param-reassign:0*/
|
|
||||||
utils.forEach(fns, function transform(fn) {
|
|
||||||
data = fn(data, headers);
|
|
||||||
});
|
|
||||||
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
|
||||||
/* 10 */
|
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var utils = __webpack_require__(2);
|
|
||||||
var settle = __webpack_require__(11);
|
|
||||||
var buildURL = __webpack_require__(14);
|
|
||||||
var parseHeaders = __webpack_require__(15);
|
|
||||||
var isURLSameOrigin = __webpack_require__(16);
|
|
||||||
var createError = __webpack_require__(12);
|
|
||||||
var btoa = (typeof window !== 'undefined' && window.btoa) || __webpack_require__(17);
|
|
||||||
|
|
||||||
module.exports = function xhrAdapter(config) {
|
module.exports = function xhrAdapter(config) {
|
||||||
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
||||||
@@ -844,7 +698,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
// The request errored out and we didn't get a response, this will be
|
// The request errored out and we didn't get a response, this will be
|
||||||
// handled by onerror instead
|
// handled by onerror instead
|
||||||
if (request.status === 0) {
|
// With one exception: request that using file: protocol, most browsers
|
||||||
|
// will return status as 0 even though it's a successful request
|
||||||
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -889,7 +745,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
// This is only done if running in a standard browser environment.
|
// This is only done if running in a standard browser environment.
|
||||||
// Specifically not if we're in a web worker, or react-native.
|
// Specifically not if we're in a web worker, or react-native.
|
||||||
if (utils.isStandardBrowserEnv()) {
|
if (utils.isStandardBrowserEnv()) {
|
||||||
var cookies = __webpack_require__(18);
|
var cookies = __webpack_require__(15);
|
||||||
|
|
||||||
// Add xsrf header
|
// Add xsrf header
|
||||||
var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
|
var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
|
||||||
@@ -940,6 +796,15 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
request.upload.addEventListener('progress', config.onUploadProgress);
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.cancelToken) {
|
||||||
|
// Handle cancellation
|
||||||
|
config.cancelToken.promise.then(function onCanceled(cancel) {
|
||||||
|
request.abort();
|
||||||
|
reject(cancel);
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (requestData === undefined) {
|
if (requestData === undefined) {
|
||||||
requestData = null;
|
requestData = null;
|
||||||
@@ -952,12 +817,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 11 */
|
/* 8 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var createError = __webpack_require__(12);
|
var createError = __webpack_require__(9);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve or reject a Promise based on response status.
|
* Resolve or reject a Promise based on response status.
|
||||||
@@ -983,12 +848,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 12 */
|
/* 9 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var enhanceError = __webpack_require__(13);
|
var enhanceError = __webpack_require__(10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an Error with the specified message, config, error code, and response.
|
* Create an Error with the specified message, config, error code, and response.
|
||||||
@@ -1006,7 +871,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 13 */
|
/* 10 */
|
||||||
/***/ function(module, exports) {
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -1031,7 +896,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 14 */
|
/* 11 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -1105,7 +970,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 15 */
|
/* 12 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -1148,7 +1013,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 16 */
|
/* 13 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -1222,7 +1087,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 17 */
|
/* 14 */
|
||||||
/***/ function(module, exports) {
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -1264,7 +1129,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 18 */
|
/* 15 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -1322,8 +1187,194 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
/* 16 */
|
||||||
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
|
module.exports = undefined;
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
/* 17 */
|
||||||
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = __webpack_require__(2);
|
||||||
|
|
||||||
|
function InterceptorManager() {
|
||||||
|
this.handlers = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new interceptor to the stack
|
||||||
|
*
|
||||||
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
||||||
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
||||||
|
*
|
||||||
|
* @return {Number} An ID used to remove interceptor later
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
||||||
|
this.handlers.push({
|
||||||
|
fulfilled: fulfilled,
|
||||||
|
rejected: rejected
|
||||||
|
});
|
||||||
|
return this.handlers.length - 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an interceptor from the stack
|
||||||
|
*
|
||||||
|
* @param {Number} id The ID that was returned by `use`
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.eject = function eject(id) {
|
||||||
|
if (this.handlers[id]) {
|
||||||
|
this.handlers[id] = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate over all the registered interceptors
|
||||||
|
*
|
||||||
|
* This method is particularly useful for skipping over any
|
||||||
|
* interceptors that may have become `null` calling `eject`.
|
||||||
|
*
|
||||||
|
* @param {Function} fn The function to call for each interceptor
|
||||||
|
*/
|
||||||
|
InterceptorManager.prototype.forEach = function forEach(fn) {
|
||||||
|
utils.forEach(this.handlers, function forEachHandler(h) {
|
||||||
|
if (h !== null) {
|
||||||
|
fn(h);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = InterceptorManager;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
/* 18 */
|
||||||
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = __webpack_require__(2);
|
||||||
|
var transformData = __webpack_require__(19);
|
||||||
|
var isCancel = __webpack_require__(20);
|
||||||
|
var defaults = __webpack_require__(5);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws a `Cancel` if cancellation has been requested.
|
||||||
|
*/
|
||||||
|
function throwIfCancellationRequested(config) {
|
||||||
|
if (config.cancelToken) {
|
||||||
|
config.cancelToken.throwIfRequested();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a request to the server using the configured adapter.
|
||||||
|
*
|
||||||
|
* @param {object} config The config that is to be used for the request
|
||||||
|
* @returns {Promise} The Promise to be fulfilled
|
||||||
|
*/
|
||||||
|
module.exports = function dispatchRequest(config) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Ensure headers exist
|
||||||
|
config.headers = config.headers || {};
|
||||||
|
|
||||||
|
// Transform request data
|
||||||
|
config.data = transformData(
|
||||||
|
config.data,
|
||||||
|
config.headers,
|
||||||
|
config.transformRequest
|
||||||
|
);
|
||||||
|
|
||||||
|
// Flatten headers
|
||||||
|
config.headers = utils.merge(
|
||||||
|
config.headers.common || {},
|
||||||
|
config.headers[config.method] || {},
|
||||||
|
config.headers || {}
|
||||||
|
);
|
||||||
|
|
||||||
|
utils.forEach(
|
||||||
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
||||||
|
function cleanHeaderConfig(method) {
|
||||||
|
delete config.headers[method];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var adapter = config.adapter || defaults.adapter;
|
||||||
|
|
||||||
|
return adapter(config).then(function onAdapterResolution(response) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Transform response data
|
||||||
|
response.data = transformData(
|
||||||
|
response.data,
|
||||||
|
response.headers,
|
||||||
|
config.transformResponse
|
||||||
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}, function onAdapterRejection(reason) {
|
||||||
|
if (!isCancel(reason)) {
|
||||||
|
throwIfCancellationRequested(config);
|
||||||
|
|
||||||
|
// Transform response data
|
||||||
|
if (reason && reason.response) {
|
||||||
|
reason.response.data = transformData(
|
||||||
|
reason.response.data,
|
||||||
|
reason.response.headers,
|
||||||
|
config.transformResponse
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject(reason);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 19 */
|
/* 19 */
|
||||||
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var utils = __webpack_require__(2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform the data for a request or a response
|
||||||
|
*
|
||||||
|
* @param {Object|String} data The data to be transformed
|
||||||
|
* @param {Array} headers The headers for the request or response
|
||||||
|
* @param {Array|Function} fns A single function or Array of functions
|
||||||
|
* @returns {*} The resulting transformed data
|
||||||
|
*/
|
||||||
|
module.exports = function transformData(data, headers, fns) {
|
||||||
|
/*eslint no-param-reassign:0*/
|
||||||
|
utils.forEach(fns, function transform(fn) {
|
||||||
|
data = fn(data, headers);
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
/* 20 */
|
||||||
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function isCancel(value) {
|
||||||
|
return !!(value && value.__CANCEL__);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
/* 21 */
|
||||||
/***/ function(module, exports) {
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -1343,7 +1394,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 20 */
|
/* 22 */
|
||||||
/***/ function(module, exports) {
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -1361,7 +1412,95 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ },
|
||||||
/* 21 */
|
/* 23 */
|
||||||
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A `Cancel` is an object that is thrown when an operation is canceled.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @param {string=} message The message.
|
||||||
|
*/
|
||||||
|
function Cancel(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cancel.prototype.toString = function toString() {
|
||||||
|
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
||||||
|
};
|
||||||
|
|
||||||
|
Cancel.prototype.__CANCEL__ = true;
|
||||||
|
|
||||||
|
module.exports = Cancel;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
/* 24 */
|
||||||
|
/***/ function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var Cancel = __webpack_require__(23);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
* @param {Function} executor The executor function.
|
||||||
|
*/
|
||||||
|
function CancelToken(executor) {
|
||||||
|
if (typeof executor !== 'function') {
|
||||||
|
throw new TypeError('executor must be a function.');
|
||||||
|
}
|
||||||
|
|
||||||
|
var resolvePromise;
|
||||||
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
||||||
|
resolvePromise = resolve;
|
||||||
|
});
|
||||||
|
|
||||||
|
var token = this;
|
||||||
|
executor(function cancel(message) {
|
||||||
|
if (token.reason) {
|
||||||
|
// Cancellation has already been requested
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
token.reason = new Cancel(message);
|
||||||
|
resolvePromise(token.reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Throws a `Cancel` if cancellation has been requested.
|
||||||
|
*/
|
||||||
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
||||||
|
if (this.reason) {
|
||||||
|
throw this.reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
||||||
|
* cancels the `CancelToken`.
|
||||||
|
*/
|
||||||
|
CancelToken.source = function source() {
|
||||||
|
var cancel;
|
||||||
|
var token = new CancelToken(function executor(c) {
|
||||||
|
cancel = c;
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
token: token,
|
||||||
|
cancel: cancel
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = CancelToken;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ },
|
||||||
|
/* 25 */
|
||||||
/***/ function(module, exports) {
|
/***/ function(module, exports) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "0.14.0",
|
"version": "0.15.0",
|
||||||
"description": "Promise based HTTP client for the browser and node.js",
|
"description": "Promise based HTTP client for the browser and node.js",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user