mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
0.10.0
This commit is contained in:
+35
-35
@@ -1,38 +1,38 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"main": "./dist/axios.js",
|
"main": "./dist/axios.js",
|
||||||
"version": "0.9.1",
|
"version": "0.10.0",
|
||||||
"homepage": "https://github.com/mzabriskie/axios",
|
"homepage": "https://github.com/mzabriskie/axios",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Matt Zabriskie"
|
"Matt Zabriskie"
|
||||||
],
|
],
|
||||||
"description": "Promise based HTTP client for the browser and node.js",
|
"description": "Promise based HTTP client for the browser and node.js",
|
||||||
"moduleType": [
|
"moduleType": [
|
||||||
"amd",
|
"amd",
|
||||||
"globals"
|
"globals"
|
||||||
],
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"xhr",
|
"xhr",
|
||||||
"http",
|
"http",
|
||||||
"ajax",
|
"ajax",
|
||||||
"promise",
|
"promise",
|
||||||
"node"
|
"node"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"**/.*",
|
"**/.*",
|
||||||
"*.iml",
|
"*.iml",
|
||||||
"examples",
|
"examples",
|
||||||
"lib",
|
"lib",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"sandbox",
|
"sandbox",
|
||||||
"test",
|
"test",
|
||||||
"CONTRIBUTING.md",
|
"CONTRIBUTING.md",
|
||||||
"COOKBOOK.md",
|
"COOKBOOK.md",
|
||||||
"Gruntfile.js",
|
"Gruntfile.js",
|
||||||
"index.js",
|
"index.js",
|
||||||
"karma.conf.js",
|
"karma.conf.js",
|
||||||
"package.json",
|
"package.json",
|
||||||
"webpack.*.js"
|
"webpack.*.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Vendored
+65
-22
@@ -1,4 +1,4 @@
|
|||||||
/* axios v0.9.1 | (c) 2016 by Matt Zabriskie */
|
/* axios v0.10.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();
|
||||||
@@ -142,22 +142,21 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
var defaultInstance = new Axios(defaults);
|
var defaultInstance = new Axios(defaults);
|
||||||
var axios = module.exports = bind(Axios.prototype.request, defaultInstance);
|
var axios = module.exports = bind(Axios.prototype.request, defaultInstance);
|
||||||
|
|
||||||
|
// Expose properties from defaultInstance
|
||||||
|
axios.defaults = defaultInstance.defaults;
|
||||||
|
axios.interceptors = defaultInstance.interceptors;
|
||||||
|
|
||||||
|
// Factory for creating new instances
|
||||||
axios.create = function create(defaultConfig) {
|
axios.create = function create(defaultConfig) {
|
||||||
return new Axios(defaultConfig);
|
return new Axios(defaultConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Expose defaults
|
|
||||||
axios.defaults = defaultInstance.defaults;
|
|
||||||
|
|
||||||
// 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__(16);
|
axios.spread = __webpack_require__(16);
|
||||||
|
|
||||||
// Expose interceptors
|
|
||||||
axios.interceptors = defaultInstance.interceptors;
|
|
||||||
|
|
||||||
// Provide aliases for supported request methods
|
// Provide aliases for supported request methods
|
||||||
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
||||||
/*eslint func-names:0*/
|
/*eslint func-names:0*/
|
||||||
@@ -197,7 +196,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
transformRequest: [function transformResponseJSON(data, headers) {
|
transformRequest: [function transformRequestJSON(data, headers) {
|
||||||
if (utils.isFormData(data)) {
|
if (utils.isFormData(data)) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -248,7 +247,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
timeout: 0,
|
timeout: 0,
|
||||||
|
|
||||||
xsrfCookieName: 'XSRF-TOKEN',
|
xsrfCookieName: 'XSRF-TOKEN',
|
||||||
xsrfHeaderName: 'X-XSRF-TOKEN'
|
xsrfHeaderName: 'X-XSRF-TOKEN',
|
||||||
|
|
||||||
|
maxContentLength: -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -553,7 +554,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
var parseHeaders = __webpack_require__(7);
|
var parseHeaders = __webpack_require__(7);
|
||||||
var transformData = __webpack_require__(8);
|
var transformData = __webpack_require__(8);
|
||||||
var isURLSameOrigin = __webpack_require__(9);
|
var isURLSameOrigin = __webpack_require__(9);
|
||||||
var btoa = window.btoa || __webpack_require__(10);
|
var btoa = (typeof window !== 'undefined' && window.btoa) || __webpack_require__(10);
|
||||||
|
|
||||||
module.exports = function xhrAdapter(resolve, reject, config) {
|
module.exports = function xhrAdapter(resolve, reject, config) {
|
||||||
var requestData = config.data;
|
var requestData = config.data;
|
||||||
@@ -564,11 +565,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
}
|
}
|
||||||
|
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
|
var loadEvent = 'onreadystatechange';
|
||||||
|
var xDomain = false;
|
||||||
|
|
||||||
// For IE 8/9 CORS support
|
// For IE 8/9 CORS support
|
||||||
// Only supports POST and GET calls and doesn't returns the response headers.
|
// Only supports POST and GET calls and doesn't returns the response headers.
|
||||||
if (window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {
|
// DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
|
||||||
|
if (("production") !== 'test' && typeof window !== 'undefined' && window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {
|
||||||
request = new window.XDomainRequest();
|
request = new window.XDomainRequest();
|
||||||
|
loadEvent = 'onload';
|
||||||
|
xDomain = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HTTP basic authentication
|
// HTTP basic authentication
|
||||||
@@ -583,14 +589,25 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
// Set the request timeout in MS
|
// Set the request timeout in MS
|
||||||
request.timeout = config.timeout;
|
request.timeout = config.timeout;
|
||||||
|
|
||||||
|
// For IE 9 CORS support.
|
||||||
|
request.onprogress = function handleProgress() {};
|
||||||
|
request.ontimeout = function handleTimeout() {};
|
||||||
|
|
||||||
// Listen for ready state
|
// Listen for ready state
|
||||||
request.onload = function handleLoad() {
|
request[loadEvent] = function handleLoad() {
|
||||||
if (!request) {
|
if (!request || (request.readyState !== 4 && !xDomain)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The request errored out and we didn't get a response, this will be
|
||||||
|
// handled by onerror instead
|
||||||
|
if (request.status === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare the response
|
// Prepare the response
|
||||||
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
||||||
var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response;
|
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
|
||||||
var response = {
|
var response = {
|
||||||
data: transformData(
|
data: transformData(
|
||||||
responseData,
|
responseData,
|
||||||
@@ -601,12 +618,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
status: request.status === 1223 ? 204 : request.status,
|
status: request.status === 1223 ? 204 : request.status,
|
||||||
statusText: request.status === 1223 ? 'No Content' : request.statusText,
|
statusText: request.status === 1223 ? 'No Content' : request.statusText,
|
||||||
headers: responseHeaders,
|
headers: responseHeaders,
|
||||||
config: config
|
config: config,
|
||||||
|
request: request
|
||||||
};
|
};
|
||||||
|
|
||||||
// Resolve or reject the Promise based on the status
|
// Resolve or reject the Promise based on the status
|
||||||
((response.status >= 200 && response.status < 300) ||
|
((response.status >= 200 && response.status < 300) ||
|
||||||
(!('status' in request) && response.responseText) ?
|
(!('status' in request) && request.responseText) ?
|
||||||
resolve :
|
resolve :
|
||||||
reject)(response);
|
reject)(response);
|
||||||
|
|
||||||
@@ -624,6 +642,17 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
request = null;
|
request = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle timeout
|
||||||
|
request.ontimeout = function handleTimeout() {
|
||||||
|
var err = new Error('timeout of ' + config.timeout + 'ms exceeded');
|
||||||
|
err.timeout = config.timeout;
|
||||||
|
err.code = 'ECONNABORTED';
|
||||||
|
reject(err);
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
// Add xsrf header
|
// Add xsrf header
|
||||||
// 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.
|
||||||
@@ -669,10 +698,24 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle progress if needed
|
||||||
|
if (config.progress) {
|
||||||
|
if (config.method === 'post' || config.method === 'put') {
|
||||||
|
request.upload.addEventListener('progress', config.progress);
|
||||||
|
} else if (config.method === 'get') {
|
||||||
|
request.addEventListener('progress', config.progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format request data
|
||||||
if (utils.isArrayBuffer(requestData)) {
|
if (utils.isArrayBuffer(requestData)) {
|
||||||
requestData = new DataView(requestData);
|
requestData = new DataView(requestData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (requestData === undefined) {
|
||||||
|
requestData = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Send the request
|
// Send the request
|
||||||
request.send(requestData);
|
request.send(requestData);
|
||||||
};
|
};
|
||||||
@@ -904,12 +947,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
|
|
||||||
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||||
|
|
||||||
function InvalidCharacterError(message) {
|
function E() {
|
||||||
this.message = message;
|
this.message = 'String contains an invalid character';
|
||||||
}
|
}
|
||||||
InvalidCharacterError.prototype = new Error;
|
E.prototype = new Error;
|
||||||
InvalidCharacterError.prototype.code = 5;
|
E.prototype.code = 5;
|
||||||
InvalidCharacterError.prototype.name = 'InvalidCharacterError';
|
E.prototype.name = 'InvalidCharacterError';
|
||||||
|
|
||||||
function btoa(input) {
|
function btoa(input) {
|
||||||
var str = String(input);
|
var str = String(input);
|
||||||
@@ -926,7 +969,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
) {
|
) {
|
||||||
charCode = str.charCodeAt(idx += 3 / 4);
|
charCode = str.charCodeAt(idx += 3 / 4);
|
||||||
if (charCode > 0xFF) {
|
if (charCode > 0xFF) {
|
||||||
throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5');
|
throw new E();
|
||||||
}
|
}
|
||||||
block = block << 8 | charCode;
|
block = block << 8 | charCode;
|
||||||
}
|
}
|
||||||
|
|||||||
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.9.1",
|
"version": "0.10.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