mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +03:00
Releasing 0.8.1
This commit is contained in:
+94
-88
@@ -1,94 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
### 0.1.0 (Aug 29, 2014)
|
||||
### 0.8.1 (Dec 14, 2015)
|
||||
|
||||
- Initial release
|
||||
|
||||
### 0.2.0 (Sep 12, 2014)
|
||||
|
||||
- Adding support for `all` and `spread`
|
||||
- Adding support for node.js ([#1](https://github.com/mzabriskie/axios/issues/1))
|
||||
|
||||
### 0.2.1 (Sep 12, 2014)
|
||||
|
||||
- Fixing build problem causing ridiculous file sizes
|
||||
|
||||
### 0.2.2 (Sep 14, 2014)
|
||||
|
||||
- Fixing bundling with browserify ([#4](https://github.com/mzabriskie/axios/issues/4))
|
||||
|
||||
### 0.3.0 (Sep 16, 2014)
|
||||
|
||||
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/mzabriskie/axios/issues/8))
|
||||
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/mzabriskie/axios/issues/6))
|
||||
- Fixing issue with `all` not working ([#7](https://github.com/mzabriskie/axios/issues/7))
|
||||
|
||||
### 0.3.1 (Sep 16, 2014)
|
||||
|
||||
- Fixing missing post body when using node.js ([#3](https://github.com/mzabriskie/axios/issues/3))
|
||||
|
||||
### 0.4.0 (Oct 03, 2014)
|
||||
|
||||
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/mzabriskie/axios/issues/10))
|
||||
- Adding support for utf-8 for node.js ([#13](https://github.com/mzabriskie/axios/issues/13))
|
||||
- Adding support for SSL for node.js ([#12](https://github.com/mzabriskie/axios/issues/12))
|
||||
- Fixing incorrect `Content-Type` header ([#9](https://github.com/mzabriskie/axios/issues/9))
|
||||
- Adding standalone build without bundled es6-promise ([#11](https://github.com/mzabriskie/axios/issues/11))
|
||||
- Deprecating `success`/`error` in favor of `then`/`catch`
|
||||
|
||||
### 0.4.1 (Oct 15, 2014)
|
||||
|
||||
- Adding error handling to request for node.js ([#18](https://github.com/mzabriskie/axios/issues/18))
|
||||
|
||||
### 0.4.2 (Dec 10, 2014)
|
||||
|
||||
- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/mzabriskie/axios/issues/22))
|
||||
- Adding support for TypeScript ([#25](https://github.com/mzabriskie/axios/issues/25))
|
||||
- Fixing issue with standalone build ([#29](https://github.com/mzabriskie/axios/issues/29))
|
||||
- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/mzabriskie/axios/issues/30))
|
||||
|
||||
### 0.5.0 (Jan 23, 2015)
|
||||
|
||||
- Adding support for intercepetors ([#14](https://github.com/mzabriskie/axios/issues/14))
|
||||
- Updating es6-promise dependency
|
||||
|
||||
### 0.5.1 (Mar 10, 2015)
|
||||
|
||||
- Fixing issue using strict mode ([#45](https://github.com/mzabriskie/axios/issues/45))
|
||||
- Fixing issue with standalone build ([#47](https://github.com/mzabriskie/axios/issues/47))
|
||||
|
||||
### 0.5.2 (Mar 13, 2015)
|
||||
|
||||
- Adding support for `statusText` in response ([#46](https://github.com/mzabriskie/axios/issues/46))
|
||||
|
||||
### 0.5.3 (Apr 07, 2015)
|
||||
|
||||
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/mzabriskie/axios/issues/55))
|
||||
|
||||
### 0.5.4 (Apr 08, 2015)
|
||||
|
||||
- Fixing issue with FormData not being sent ([#53](https://github.com/mzabriskie/axios/issues/53))
|
||||
|
||||
### 0.6.0 (Sep 21, 2015)
|
||||
|
||||
- Removing deprecated success/error aliases
|
||||
- Fixing issue with array params not being properly encoded ([#49](https://github.com/mzabriskie/axios/pull/49))
|
||||
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/mzabriskie/axios/issues/69))
|
||||
- Adding support for timeout config ([#56](https://github.com/mzabriskie/axios/issues/56))
|
||||
- Removing es6-promise dependency
|
||||
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/mzabriskie/axios/pull/91))
|
||||
- Fixing issue with IE8 ([#85](https://github.com/mzabriskie/axios/pull/85))
|
||||
- Converting build to UMD
|
||||
|
||||
### 0.7.0 (Sep 29, 2015)
|
||||
|
||||
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/mzabriskie/axios/pull/87))
|
||||
- Adding support for passing agent in node ([#102](https://github.com/mzabriskie/axios/pull/102))
|
||||
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/mzabriskie/axios/pull/106))
|
||||
- Fixing typescript definition ([#105](https://github.com/mzabriskie/axios/pull/105))
|
||||
- Fixing default timeout config for node ([#112](https://github.com/mzabriskie/axios/pull/112))
|
||||
- Adding support for use in web workers, and react-native ([#70](https://github.com/mzabriskie/axios/issue/70)), ([#98](https://github.com/mzabriskie/axios/pull/98))
|
||||
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/mzabriskie/axios/issues/116))
|
||||
- Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/mzabriskie/axios/pull/168))
|
||||
- Fixing error with format of basic auth header ([#178](https://github.com/mzabriskie/axios/pull/173))
|
||||
- Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/mzabriskie/axios/pull/174))
|
||||
|
||||
### 0.8.0 (Dec 11, 2015)
|
||||
|
||||
@@ -101,3 +17,93 @@
|
||||
- Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/mzabriskie/axios/pull/140))
|
||||
- Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/mzabriskie/axios/pull/167))
|
||||
- Adding support for baseURL option ([#160](https://github.com/mzabriskie/axios/pull/160))
|
||||
|
||||
### 0.7.0 (Sep 29, 2015)
|
||||
|
||||
- Fixing issue with minified bundle in IE8 ([#87](https://github.com/mzabriskie/axios/pull/87))
|
||||
- Adding support for passing agent in node ([#102](https://github.com/mzabriskie/axios/pull/102))
|
||||
- Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/mzabriskie/axios/pull/106))
|
||||
- Fixing typescript definition ([#105](https://github.com/mzabriskie/axios/pull/105))
|
||||
- Fixing default timeout config for node ([#112](https://github.com/mzabriskie/axios/pull/112))
|
||||
- Adding support for use in web workers, and react-native ([#70](https://github.com/mzabriskie/axios/issue/70)), ([#98](https://github.com/mzabriskie/axios/pull/98))
|
||||
- Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/mzabriskie/axios/issues/116))
|
||||
|
||||
### 0.6.0 (Sep 21, 2015)
|
||||
|
||||
- Removing deprecated success/error aliases
|
||||
- Fixing issue with array params not being properly encoded ([#49](https://github.com/mzabriskie/axios/pull/49))
|
||||
- Fixing issue with User-Agent getting overridden ([#69](https://github.com/mzabriskie/axios/issues/69))
|
||||
- Adding support for timeout config ([#56](https://github.com/mzabriskie/axios/issues/56))
|
||||
- Removing es6-promise dependency
|
||||
- Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/mzabriskie/axios/pull/91))
|
||||
- Fixing issue with IE8 ([#85](https://github.com/mzabriskie/axios/pull/85))
|
||||
- Converting build to UMD
|
||||
|
||||
### 0.5.4 (Apr 08, 2015)
|
||||
|
||||
- Fixing issue with FormData not being sent ([#53](https://github.com/mzabriskie/axios/issues/53))
|
||||
|
||||
### 0.5.3 (Apr 07, 2015)
|
||||
|
||||
- Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/mzabriskie/axios/issues/55))
|
||||
|
||||
### 0.5.2 (Mar 13, 2015)
|
||||
|
||||
- Adding support for `statusText` in response ([#46](https://github.com/mzabriskie/axios/issues/46))
|
||||
|
||||
### 0.5.1 (Mar 10, 2015)
|
||||
|
||||
- Fixing issue using strict mode ([#45](https://github.com/mzabriskie/axios/issues/45))
|
||||
- Fixing issue with standalone build ([#47](https://github.com/mzabriskie/axios/issues/47))
|
||||
|
||||
### 0.5.0 (Jan 23, 2015)
|
||||
|
||||
- Adding support for intercepetors ([#14](https://github.com/mzabriskie/axios/issues/14))
|
||||
- Updating es6-promise dependency
|
||||
|
||||
### 0.4.2 (Dec 10, 2014)
|
||||
|
||||
- Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/mzabriskie/axios/issues/22))
|
||||
- Adding support for TypeScript ([#25](https://github.com/mzabriskie/axios/issues/25))
|
||||
- Fixing issue with standalone build ([#29](https://github.com/mzabriskie/axios/issues/29))
|
||||
- Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/mzabriskie/axios/issues/30))
|
||||
|
||||
### 0.4.1 (Oct 15, 2014)
|
||||
|
||||
- Adding error handling to request for node.js ([#18](https://github.com/mzabriskie/axios/issues/18))
|
||||
|
||||
### 0.4.0 (Oct 03, 2014)
|
||||
|
||||
- Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/mzabriskie/axios/issues/10))
|
||||
- Adding support for utf-8 for node.js ([#13](https://github.com/mzabriskie/axios/issues/13))
|
||||
- Adding support for SSL for node.js ([#12](https://github.com/mzabriskie/axios/issues/12))
|
||||
- Fixing incorrect `Content-Type` header ([#9](https://github.com/mzabriskie/axios/issues/9))
|
||||
- Adding standalone build without bundled es6-promise ([#11](https://github.com/mzabriskie/axios/issues/11))
|
||||
- Deprecating `success`/`error` in favor of `then`/`catch`
|
||||
|
||||
### 0.3.1 (Sep 16, 2014)
|
||||
|
||||
- Fixing missing post body when using node.js ([#3](https://github.com/mzabriskie/axios/issues/3))
|
||||
|
||||
### 0.3.0 (Sep 16, 2014)
|
||||
|
||||
- Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/mzabriskie/axios/issues/8))
|
||||
- Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/mzabriskie/axios/issues/6))
|
||||
- Fixing issue with `all` not working ([#7](https://github.com/mzabriskie/axios/issues/7))
|
||||
|
||||
### 0.2.2 (Sep 14, 2014)
|
||||
|
||||
- Fixing bundling with browserify ([#4](https://github.com/mzabriskie/axios/issues/4))
|
||||
|
||||
### 0.2.1 (Sep 12, 2014)
|
||||
|
||||
- Fixing build problem causing ridiculous file sizes
|
||||
|
||||
### 0.2.0 (Sep 12, 2014)
|
||||
|
||||
- Adding support for `all` and `spread`
|
||||
- Adding support for node.js ([#1](https://github.com/mzabriskie/axios/issues/1))
|
||||
|
||||
### 0.1.0 (Aug 29, 2014)
|
||||
|
||||
- Initial release
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Axios v0.8.0
|
||||
// Type definitions for Axios v0.8.1
|
||||
// Project: https://github.com/mzabriskie/axios
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"main": "./dist/axios.js",
|
||||
"version": "0.8.0",
|
||||
"version": "0.8.1",
|
||||
"homepage": "https://github.com/mzabriskie/axios",
|
||||
"authors": [
|
||||
"Matt Zabriskie"
|
||||
|
||||
Vendored
+100
-81
@@ -69,8 +69,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
var InterceptorManager = __webpack_require__(12);
|
||||
var isAbsoluteURL = __webpack_require__(13);
|
||||
var combineURLs = __webpack_require__(14);
|
||||
var bind = __webpack_require__(15);
|
||||
|
||||
function Axios (defaultConfig) {
|
||||
function Axios(defaultConfig) {
|
||||
this.defaultConfig = utils.merge({
|
||||
headers: {},
|
||||
timeout: defaults.timeout,
|
||||
@@ -84,7 +85,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
};
|
||||
}
|
||||
|
||||
Axios.prototype.request = function (config) {
|
||||
Axios.prototype.request = function request(config) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
// Allow for axios('example/url'[, config]) a la fetch API
|
||||
if (typeof config === 'string') {
|
||||
config = utils.merge({
|
||||
@@ -105,11 +107,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
var chain = [dispatchRequest, undefined];
|
||||
var promise = Promise.resolve(config);
|
||||
|
||||
this.interceptors.request.forEach(function (interceptor) {
|
||||
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
||||
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
||||
});
|
||||
|
||||
this.interceptors.response.forEach(function (interceptor) {
|
||||
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
||||
chain.push(interceptor.fulfilled, interceptor.rejected);
|
||||
});
|
||||
|
||||
@@ -124,7 +126,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
|
||||
var axios = module.exports = bind(Axios.prototype.request, defaultInstance);
|
||||
|
||||
axios.create = function (defaultConfig) {
|
||||
axios.create = function create(defaultConfig) {
|
||||
return new Axios(defaultConfig);
|
||||
};
|
||||
|
||||
@@ -132,28 +134,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
axios.defaults = defaults;
|
||||
|
||||
// Expose all/spread
|
||||
axios.all = function (promises) {
|
||||
axios.all = function all(promises) {
|
||||
return Promise.all(promises);
|
||||
};
|
||||
axios.spread = __webpack_require__(15);
|
||||
axios.spread = __webpack_require__(16);
|
||||
|
||||
// Expose interceptors
|
||||
axios.interceptors = defaultInstance.interceptors;
|
||||
|
||||
// Helpers
|
||||
function bind (fn, thisArg) {
|
||||
return function () {
|
||||
var args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
return fn.apply(thisArg, args);
|
||||
};
|
||||
}
|
||||
|
||||
// Provide aliases for supported request methods
|
||||
utils.forEach(['delete', 'get', 'head'], function (method) {
|
||||
Axios.prototype[method] = function (url, config) {
|
||||
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
||||
/*eslint func-names:0*/
|
||||
Axios.prototype[method] = function(url, config) {
|
||||
return this.request(utils.merge(config || {}, {
|
||||
method: method,
|
||||
url: url
|
||||
@@ -162,8 +154,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
axios[method] = bind(Axios.prototype[method], defaultInstance);
|
||||
});
|
||||
|
||||
utils.forEach(['post', 'put', 'patch'], function (method) {
|
||||
Axios.prototype[method] = function (url, data, config) {
|
||||
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||
/*eslint func-names:0*/
|
||||
Axios.prototype[method] = function(url, data, config) {
|
||||
return this.request(utils.merge(config || {}, {
|
||||
method: method,
|
||||
url: url,
|
||||
@@ -188,8 +181,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
transformRequest: [function (data, headers) {
|
||||
if(utils.isFormData(data)) {
|
||||
transformRequest: [function transformResponseJSON(data, headers) {
|
||||
if (utils.isFormData(data)) {
|
||||
return data;
|
||||
}
|
||||
if (utils.isArrayBuffer(data)) {
|
||||
@@ -201,7 +194,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {
|
||||
// Set application/json if no Content-Type has been specified
|
||||
if (!utils.isUndefined(headers)) {
|
||||
utils.forEach(headers, function (val, key) {
|
||||
utils.forEach(headers, function processContentTypeHeader(val, key) {
|
||||
if (key.toLowerCase() === 'content-type') {
|
||||
headers['Content-Type'] = val;
|
||||
}
|
||||
@@ -216,7 +209,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
return data;
|
||||
}],
|
||||
|
||||
transformResponse: [function (data) {
|
||||
transformResponse: [function transformResponseJSON(data) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
if (typeof data === 'string') {
|
||||
data = data.replace(PROTECTION_PREFIX, '');
|
||||
try {
|
||||
@@ -291,11 +285,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
||||
*/
|
||||
function isArrayBufferView(val) {
|
||||
var result;
|
||||
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
||||
return ArrayBuffer.isView(val);
|
||||
result = ArrayBuffer.isView(val);
|
||||
} else {
|
||||
return (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
||||
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,17 +415,17 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
|
||||
// Force an array if not already something iterable
|
||||
if (typeof obj !== 'object' && !isArray(obj)) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
obj = [obj];
|
||||
}
|
||||
|
||||
// Iterate over array values
|
||||
if (isArray(obj)) {
|
||||
// Iterate over array values
|
||||
for (var i = 0, l = obj.length; i < l; i++) {
|
||||
fn.call(null, obj[i], i, obj);
|
||||
}
|
||||
}
|
||||
// Iterate over object keys
|
||||
else {
|
||||
} else {
|
||||
// Iterate over object keys
|
||||
for (var key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
fn.call(null, obj[key], key, obj);
|
||||
@@ -455,11 +451,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* @param {Object} obj1 Object to merge
|
||||
* @returns {Object} Result of all merge properties
|
||||
*/
|
||||
function merge(/*obj1, obj2, obj3, ...*/) {
|
||||
function merge(/* obj1, obj2, obj3, ... */) {
|
||||
var result = {};
|
||||
var assignValue = function (val, key) { result[key] = val; };
|
||||
var length = arguments.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
function assignValue(val, key) {
|
||||
result[key] = val;
|
||||
}
|
||||
|
||||
for (var i = 0, l = arguments.length; i < l; i++) {
|
||||
forEach(arguments[i], assignValue);
|
||||
}
|
||||
return result;
|
||||
@@ -498,14 +496,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* @returns {Promise} The Promise to be fulfilled
|
||||
*/
|
||||
module.exports = function dispatchRequest(config) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise(function executor(resolve, reject) {
|
||||
try {
|
||||
// For browsers use XHR adapter
|
||||
if ((typeof XMLHttpRequest !== 'undefined') || (typeof ActiveXObject !== 'undefined')) {
|
||||
// For browsers use XHR adapter
|
||||
__webpack_require__(5)(resolve, reject, config);
|
||||
}
|
||||
// For node use HTTP adapter
|
||||
else if (typeof process !== 'undefined') {
|
||||
} else if (typeof process !== 'undefined') {
|
||||
// For node use HTTP adapter
|
||||
__webpack_require__(5)(resolve, reject, config);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -530,7 +527,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
var parseHeaders = __webpack_require__(7);
|
||||
var transformData = __webpack_require__(8);
|
||||
var isURLSameOrigin = __webpack_require__(9);
|
||||
var btoa = window.btoa || __webpack_require__(10)
|
||||
var btoa = window.btoa || __webpack_require__(10);
|
||||
|
||||
module.exports = function xhrAdapter(resolve, reject, config) {
|
||||
// Transform request data
|
||||
@@ -551,13 +548,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
delete requestHeaders['Content-Type']; // Let the browser set it
|
||||
}
|
||||
|
||||
var adapter = (XMLHttpRequest || ActiveXObject);
|
||||
var Adapter = (XMLHttpRequest || ActiveXObject);
|
||||
var loadEvent = 'onreadystatechange';
|
||||
var xDomain = false;
|
||||
|
||||
// For IE 8/9 CORS support
|
||||
if(!isURLSameOrigin(config.url) && window.XDomainRequest){
|
||||
adapter = window.XDomainRequest;
|
||||
if (!isURLSameOrigin(config.url) && window.XDomainRequest) {
|
||||
Adapter = window.XDomainRequest;
|
||||
loadEvent = 'onload';
|
||||
xDomain = true;
|
||||
}
|
||||
@@ -566,18 +563,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
if (config.auth) {
|
||||
var username = config.auth.username || '';
|
||||
var password = config.auth.password || '';
|
||||
requestHeaders['Authorization'] = 'Basic: ' + btoa(username + ':' + password);
|
||||
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
||||
}
|
||||
|
||||
// Create the request
|
||||
var request = new adapter('Microsoft.XMLHTTP');
|
||||
var request = new Adapter('Microsoft.XMLHTTP');
|
||||
request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
|
||||
|
||||
// Set the request timeout in MS
|
||||
request.timeout = config.timeout;
|
||||
|
||||
// Listen for ready state
|
||||
request[loadEvent] = function () {
|
||||
request[loadEvent] = function handleReadyState() {
|
||||
if (request && (request.readyState === 4 || xDomain)) {
|
||||
// Prepare the response
|
||||
var responseHeaders = xDomain ? null : parseHeaders(request.getAllResponseHeaders());
|
||||
@@ -594,7 +591,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
config: config
|
||||
};
|
||||
// Resolve or reject the Promise based on the status
|
||||
((request.status >= 200 && request.status < 300) || (request.responseText && xDomain) ?
|
||||
((request.status >= 200 && request.status < 300) || (xDomain && request.responseText) ?
|
||||
resolve :
|
||||
reject)(response);
|
||||
|
||||
@@ -610,7 +607,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
var cookies = __webpack_require__(11);
|
||||
|
||||
// Add xsrf header
|
||||
var xsrfValue = isURLSameOrigin(config.url) ?
|
||||
var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?
|
||||
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) :
|
||||
undefined;
|
||||
|
||||
@@ -620,17 +617,17 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
}
|
||||
|
||||
// Add headers to the request
|
||||
if(!xDomain)
|
||||
utils.forEach(requestHeaders, function (val, key) {
|
||||
// Remove Content-Type if data is undefined
|
||||
if (!xDomain) {
|
||||
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
||||
if (!data && key.toLowerCase() === 'content-type') {
|
||||
// Remove Content-Type if data is undefined
|
||||
delete requestHeaders[key];
|
||||
}
|
||||
// Otherwise add header to the request
|
||||
else {
|
||||
} else {
|
||||
// Otherwise add header to the request
|
||||
request.setRequestHeader(key, val);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add withCredentials to request if needed
|
||||
if (config.withCredentials) {
|
||||
@@ -684,6 +681,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* @returns {string} The formatted url
|
||||
*/
|
||||
module.exports = function buildURL(url, params, paramsSerializer) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
if (!params) {
|
||||
return url;
|
||||
}
|
||||
@@ -691,11 +689,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
var serializedParams;
|
||||
if (paramsSerializer) {
|
||||
serializedParams = paramsSerializer(params);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
var parts = [];
|
||||
|
||||
utils.forEach(params, function (val, key) {
|
||||
utils.forEach(params, function serialize(val, key) {
|
||||
if (val === null || typeof val === 'undefined') {
|
||||
return;
|
||||
}
|
||||
@@ -708,11 +705,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
val = [val];
|
||||
}
|
||||
|
||||
utils.forEach(val, function (v) {
|
||||
utils.forEach(val, function parseValue(v) {
|
||||
if (utils.isDate(v)) {
|
||||
v = v.toISOString();
|
||||
}
|
||||
else if (utils.isObject(v)) {
|
||||
} else if (utils.isObject(v)) {
|
||||
v = JSON.stringify(v);
|
||||
}
|
||||
parts.push(encode(key) + '=' + encode(v));
|
||||
@@ -753,11 +749,14 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* @returns {Object} Headers parsed into an object
|
||||
*/
|
||||
module.exports = function parseHeaders(headers) {
|
||||
var parsed = {}, key, val, i;
|
||||
var parsed = {};
|
||||
var key;
|
||||
var val;
|
||||
var i;
|
||||
|
||||
if (!headers) { return parsed; }
|
||||
|
||||
utils.forEach(headers.split('\n'), function(line) {
|
||||
utils.forEach(headers.split('\n'), function parser(line) {
|
||||
i = line.indexOf(':');
|
||||
key = utils.trim(line.substr(0, i)).toLowerCase();
|
||||
val = utils.trim(line.substr(i + 1));
|
||||
@@ -788,7 +787,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* @returns {*} The resulting transformed data
|
||||
*/
|
||||
module.exports = function transformData(data, headers, fns) {
|
||||
utils.forEach(fns, function (fn) {
|
||||
/*eslint no-param-reassign:0*/
|
||||
utils.forEach(fns, function transform(fn) {
|
||||
data = fn(data, headers);
|
||||
});
|
||||
|
||||
@@ -809,7 +809,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
|
||||
// Standard browser envs have full support of the APIs needed to test
|
||||
// whether the request URL is of the same origin as current location.
|
||||
(function () {
|
||||
(function standardBrowserEnv() {
|
||||
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
||||
var urlParsingNode = document.createElement('a');
|
||||
var originURL;
|
||||
@@ -862,7 +862,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
})() :
|
||||
|
||||
// Non standard browser envs (web workers, react-native) lack needed support.
|
||||
(function () {
|
||||
(function nonStandardBrowserEnv() {
|
||||
return function isURLSameOrigin() {
|
||||
return true;
|
||||
};
|
||||
@@ -884,13 +884,15 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
this.message = message;
|
||||
}
|
||||
InvalidCharacterError.prototype = new Error;
|
||||
InvalidCharacterError.prototype.code = 5;
|
||||
InvalidCharacterError.prototype.name = 'InvalidCharacterError';
|
||||
|
||||
function btoa (input) {
|
||||
function btoa(input) {
|
||||
var str = String(input);
|
||||
var output = '';
|
||||
for (
|
||||
// initialize result and counter
|
||||
var block, charCode, idx = 0, map = chars, output = '';
|
||||
var block, charCode, idx = 0, map = chars;
|
||||
// if the next str index does not exist:
|
||||
// change the mapping table to "="
|
||||
// check if d has no fractional digits
|
||||
@@ -898,16 +900,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
|
||||
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
|
||||
) {
|
||||
charCode = str.charCodeAt(idx += 3/4);
|
||||
charCode = str.charCodeAt(idx += 3 / 4);
|
||||
if (charCode > 0xFF) {
|
||||
throw new InvalidCharacterError('\'btoa\' failed: The string to be encoded contains characters outside of the Latin1 range.');
|
||||
throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5');
|
||||
}
|
||||
block = block << 8 | charCode;
|
||||
}
|
||||
return output;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = btoa
|
||||
module.exports = btoa;
|
||||
|
||||
|
||||
/***/ },
|
||||
@@ -922,7 +924,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
utils.isStandardBrowserEnv() ?
|
||||
|
||||
// Standard browser envs support document.cookie
|
||||
(function () {
|
||||
(function standardBrowserEnv() {
|
||||
return {
|
||||
write: function write(name, value, expires, path, domain, secure) {
|
||||
var cookie = [];
|
||||
@@ -959,7 +961,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
})() :
|
||||
|
||||
// Non standard browser env (web workers, react-native) lack needed support.
|
||||
(function () {
|
||||
(function nonStandardBrowserEnv() {
|
||||
return {
|
||||
write: function write() {},
|
||||
read: function read() { return null; },
|
||||
@@ -989,7 +991,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
*
|
||||
* @return {Number} An ID used to remove interceptor later
|
||||
*/
|
||||
InterceptorManager.prototype.use = function (fulfilled, rejected) {
|
||||
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
||||
this.handlers.push({
|
||||
fulfilled: fulfilled,
|
||||
rejected: rejected
|
||||
@@ -1002,7 +1004,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
*
|
||||
* @param {Number} id The ID that was returned by `use`
|
||||
*/
|
||||
InterceptorManager.prototype.eject = function (id) {
|
||||
InterceptorManager.prototype.eject = function eject(id) {
|
||||
if (this.handlers[id]) {
|
||||
this.handlers[id] = null;
|
||||
}
|
||||
@@ -1012,12 +1014,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* Iterate over all the registered interceptors
|
||||
*
|
||||
* This method is particularly useful for skipping over any
|
||||
* interceptors that may have become `null` calling `remove`.
|
||||
* interceptors that may have become `null` calling `eject`.
|
||||
*
|
||||
* @param {Function} fn The function to call for each interceptor
|
||||
*/
|
||||
InterceptorManager.prototype.forEach = function (fn) {
|
||||
utils.forEach(this.handlers, function (h) {
|
||||
InterceptorManager.prototype.forEach = function forEach(fn) {
|
||||
utils.forEach(this.handlers, function forEachHandler(h) {
|
||||
if (h !== null) {
|
||||
fn(h);
|
||||
}
|
||||
@@ -1071,6 +1073,23 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function bind(fn, thisArg) {
|
||||
return function wrap() {
|
||||
var args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
return fn.apply(thisArg, args);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 16 */
|
||||
/***/ function(module, exports) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
||||
*
|
||||
@@ -1092,7 +1111,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* @returns {Function}
|
||||
*/
|
||||
module.exports = function spread(callback) {
|
||||
return function (arr) {
|
||||
return function wrap(arr) {
|
||||
return callback.apply(null, arr);
|
||||
};
|
||||
};
|
||||
|
||||
Vendored
+1
-1
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
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"version": "0.8.0",
|
||||
"version": "0.8.1",
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user