mirror of
https://github.com/tenrok/axios.git
synced 2026-05-21 13:24:11 +03:00
0.10.0
This commit is contained in:
+35
-35
@@ -1,38 +1,38 @@
|
||||
{
|
||||
"name": "axios",
|
||||
"main": "./dist/axios.js",
|
||||
"version": "0.9.1",
|
||||
"homepage": "https://github.com/mzabriskie/axios",
|
||||
"authors": [
|
||||
"Matt Zabriskie"
|
||||
],
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals"
|
||||
],
|
||||
"keywords": [
|
||||
"xhr",
|
||||
"http",
|
||||
"ajax",
|
||||
"promise",
|
||||
"node"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"*.iml",
|
||||
"examples",
|
||||
"lib",
|
||||
"node_modules",
|
||||
"sandbox",
|
||||
"test",
|
||||
"CONTRIBUTING.md",
|
||||
"name": "axios",
|
||||
"main": "./dist/axios.js",
|
||||
"version": "0.10.0",
|
||||
"homepage": "https://github.com/mzabriskie/axios",
|
||||
"authors": [
|
||||
"Matt Zabriskie"
|
||||
],
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals"
|
||||
],
|
||||
"keywords": [
|
||||
"xhr",
|
||||
"http",
|
||||
"ajax",
|
||||
"promise",
|
||||
"node"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"*.iml",
|
||||
"examples",
|
||||
"lib",
|
||||
"node_modules",
|
||||
"sandbox",
|
||||
"test",
|
||||
"CONTRIBUTING.md",
|
||||
"COOKBOOK.md",
|
||||
"Gruntfile.js",
|
||||
"index.js",
|
||||
"karma.conf.js",
|
||||
"package.json",
|
||||
"Gruntfile.js",
|
||||
"index.js",
|
||||
"karma.conf.js",
|
||||
"package.json",
|
||||
"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) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
@@ -142,22 +142,21 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
var defaultInstance = new Axios(defaults);
|
||||
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) {
|
||||
return new Axios(defaultConfig);
|
||||
};
|
||||
|
||||
// Expose defaults
|
||||
axios.defaults = defaultInstance.defaults;
|
||||
|
||||
// Expose all/spread
|
||||
axios.all = function all(promises) {
|
||||
return Promise.all(promises);
|
||||
};
|
||||
axios.spread = __webpack_require__(16);
|
||||
|
||||
// Expose interceptors
|
||||
axios.interceptors = defaultInstance.interceptors;
|
||||
|
||||
// Provide aliases for supported request methods
|
||||
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
||||
/*eslint func-names:0*/
|
||||
@@ -197,7 +196,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
transformRequest: [function transformResponseJSON(data, headers) {
|
||||
transformRequest: [function transformRequestJSON(data, headers) {
|
||||
if (utils.isFormData(data)) {
|
||||
return data;
|
||||
}
|
||||
@@ -248,7 +247,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
timeout: 0,
|
||||
|
||||
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 transformData = __webpack_require__(8);
|
||||
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) {
|
||||
var requestData = config.data;
|
||||
@@ -564,11 +565,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
}
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
var loadEvent = 'onreadystatechange';
|
||||
var xDomain = false;
|
||||
|
||||
// For IE 8/9 CORS support
|
||||
// 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();
|
||||
loadEvent = 'onload';
|
||||
xDomain = true;
|
||||
}
|
||||
|
||||
// HTTP basic authentication
|
||||
@@ -583,14 +589,25 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
// Set the request timeout in MS
|
||||
request.timeout = config.timeout;
|
||||
|
||||
// For IE 9 CORS support.
|
||||
request.onprogress = function handleProgress() {};
|
||||
request.ontimeout = function handleTimeout() {};
|
||||
|
||||
// Listen for ready state
|
||||
request.onload = function handleLoad() {
|
||||
if (!request) {
|
||||
request[loadEvent] = function handleLoad() {
|
||||
if (!request || (request.readyState !== 4 && !xDomain)) {
|
||||
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
|
||||
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 = {
|
||||
data: transformData(
|
||||
responseData,
|
||||
@@ -601,12 +618,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
status: request.status === 1223 ? 204 : request.status,
|
||||
statusText: request.status === 1223 ? 'No Content' : request.statusText,
|
||||
headers: responseHeaders,
|
||||
config: config
|
||||
config: config,
|
||||
request: request
|
||||
};
|
||||
|
||||
// Resolve or reject the Promise based on the status
|
||||
((response.status >= 200 && response.status < 300) ||
|
||||
(!('status' in request) && response.responseText) ?
|
||||
(!('status' in request) && request.responseText) ?
|
||||
resolve :
|
||||
reject)(response);
|
||||
|
||||
@@ -624,6 +642,17 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
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
|
||||
// This is only done if running in a standard browser environment.
|
||||
// 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)) {
|
||||
requestData = new DataView(requestData);
|
||||
}
|
||||
|
||||
if (requestData === undefined) {
|
||||
requestData = null;
|
||||
}
|
||||
|
||||
// Send the request
|
||||
request.send(requestData);
|
||||
};
|
||||
@@ -904,12 +947,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
|
||||
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
|
||||
function InvalidCharacterError(message) {
|
||||
this.message = message;
|
||||
function E() {
|
||||
this.message = 'String contains an invalid character';
|
||||
}
|
||||
InvalidCharacterError.prototype = new Error;
|
||||
InvalidCharacterError.prototype.code = 5;
|
||||
InvalidCharacterError.prototype.name = 'InvalidCharacterError';
|
||||
E.prototype = new Error;
|
||||
E.prototype.code = 5;
|
||||
E.prototype.name = 'InvalidCharacterError';
|
||||
|
||||
function btoa(input) {
|
||||
var str = String(input);
|
||||
@@ -926,7 +969,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
) {
|
||||
charCode = str.charCodeAt(idx += 3 / 4);
|
||||
if (charCode > 0xFF) {
|
||||
throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5');
|
||||
throw new E();
|
||||
}
|
||||
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",
|
||||
"version": "0.9.1",
|
||||
"version": "0.10.0",
|
||||
"description": "Promise based HTTP client for the browser and node.js",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user