mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
chore(release): v1.7.0-beta.1 (#6383)
Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
bb5f9a5ab7
commit
b9f4848f8c
@@ -1,5 +1,19 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
# [1.7.0-beta.1](https://github.com/axios/axios/compare/v1.7.0-beta.0...v1.7.0-beta.1) (2024-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **core/axios:** handle un-writable error stack ([#6362](https://github.com/axios/axios/issues/6362)) ([81e0455](https://github.com/axios/axios/commit/81e0455b7b57fbaf2be16a73ebe0e6591cc6d8f9))
|
||||||
|
* **fetch:** fix cases when ReadableStream or Response.body are not available; ([#6377](https://github.com/axios/axios/issues/6377)) ([d1d359d](https://github.com/axios/axios/commit/d1d359da347704e8b28d768e61515a3e96c5b072))
|
||||||
|
* **fetch:** treat fetch-related TypeError as an AxiosError.ERR_NETWORK error; ([#6380](https://github.com/axios/axios/issues/6380)) ([bb5f9a5](https://github.com/axios/axios/commit/bb5f9a5ab768452de9e166dc28d0ffc234245ef1))
|
||||||
|
|
||||||
|
### Contributors to this release
|
||||||
|
|
||||||
|
- <img src="https://avatars.githubusercontent.com/u/16711696?v=4&s=18" alt="avatar" width="18"/> [Alexandre ABRIOUX](https://github.com/alexandre-abrioux "+56/-6 (#6362 )")
|
||||||
|
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+42/-17 (#6380 #6377 )")
|
||||||
|
|
||||||
# [1.7.0-beta.0](https://github.com/axios/axios/compare/v1.6.8...v1.7.0-beta.0) (2024-04-28)
|
# [1.7.0-beta.0](https://github.com/axios/axios/compare/v1.6.8...v1.7.0-beta.0) (2024-04-28)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"main": "./dist/axios.js",
|
"main": "./dist/axios.js",
|
||||||
"version": "1.7.0-beta.0",
|
"version": "1.7.0-beta.1",
|
||||||
"homepage": "https://axios-http.com",
|
"homepage": "https://axios-http.com",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Matt Zabriskie"
|
"Matt Zabriskie"
|
||||||
|
|||||||
Vendored
+43
-25
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.7.0-beta.0 Copyright (c) 2024 Matt Zabriskie and contributors
|
// Axios v1.7.0-beta.1 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||||
typeof define === 'function' && define.amd ? define(factory) :
|
typeof define === 'function' && define.amd ? define(factory) :
|
||||||
@@ -3226,7 +3226,8 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
var isFetchSupported = typeof fetch !== 'undefined';
|
var isFetchSupported = typeof fetch !== 'undefined';
|
||||||
var supportsRequestStreams = isFetchSupported && function () {
|
var isReadableStreamSupported = isFetchSupported && typeof ReadableStream !== 'undefined';
|
||||||
|
var supportsRequestStream = isReadableStreamSupported && function () {
|
||||||
var duplexAccessed = false;
|
var duplexAccessed = false;
|
||||||
var hasContentType = new Request(platform.origin, {
|
var hasContentType = new Request(platform.origin, {
|
||||||
body: new ReadableStream(),
|
body: new ReadableStream(),
|
||||||
@@ -3239,18 +3240,27 @@
|
|||||||
return duplexAccessed && !hasContentType;
|
return duplexAccessed && !hasContentType;
|
||||||
}();
|
}();
|
||||||
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
||||||
|
var supportsResponseStream = isReadableStreamSupported && !!function () {
|
||||||
|
try {
|
||||||
|
return utils$1.isReadableStream(new Response('').body);
|
||||||
|
} catch (err) {
|
||||||
|
// return undefined
|
||||||
|
}
|
||||||
|
}();
|
||||||
var resolvers = {
|
var resolvers = {
|
||||||
stream: function stream(res) {
|
stream: supportsResponseStream && function (res) {
|
||||||
return res.body;
|
return res.body;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
isFetchSupported && ['text', 'arrayBuffer', 'blob', 'formData'].forEach(function (type) {
|
isFetchSupported && function (res) {
|
||||||
return [resolvers[type] = utils$1.isFunction(Response.prototype[type]) ? function (res) {
|
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
|
||||||
return res[type]();
|
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? function (res) {
|
||||||
} : function (_, config) {
|
return res[type]();
|
||||||
throw new AxiosError("Response type ".concat(type, " is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
|
} : function (_, config) {
|
||||||
}];
|
throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}(new Response());
|
||||||
var getBodyLength = /*#__PURE__*/function () {
|
var getBodyLength = /*#__PURE__*/function () {
|
||||||
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(body) {
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(body) {
|
||||||
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
||||||
@@ -3316,9 +3326,9 @@
|
|||||||
return _ref2.apply(this, arguments);
|
return _ref2.apply(this, arguments);
|
||||||
};
|
};
|
||||||
}();
|
}();
|
||||||
var fetchAdapter = ( /*#__PURE__*/(function () {
|
var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
|
||||||
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(config) {
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(config) {
|
||||||
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref4, _ref5, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, response, isStreamResponse, options, responseContentLength, responseData, code;
|
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref4, _ref5, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, response, isStreamResponse, options, responseContentLength, responseData;
|
||||||
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
||||||
while (1) switch (_context3.prev = _context3.next) {
|
while (1) switch (_context3.prev = _context3.next) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -3332,7 +3342,7 @@
|
|||||||
finished = true;
|
finished = true;
|
||||||
};
|
};
|
||||||
_context3.prev = 4;
|
_context3.prev = 4;
|
||||||
if (!(onUploadProgress && supportsRequestStreams && method !== 'get' && method !== 'head')) {
|
if (!(onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head')) {
|
||||||
_context3.next = 12;
|
_context3.next = 12;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3366,7 +3376,7 @@
|
|||||||
case 16:
|
case 16:
|
||||||
response = _context3.sent;
|
response = _context3.sent;
|
||||||
isStreamResponse = responseType === 'stream' || responseType === 'response';
|
isStreamResponse = responseType === 'stream' || responseType === 'response';
|
||||||
if (onDownloadProgress || isStreamResponse) {
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
||||||
options = {};
|
options = {};
|
||||||
Object.getOwnPropertyNames(response).forEach(function (prop) {
|
Object.getOwnPropertyNames(response).forEach(function (prop) {
|
||||||
options[prop] = response[prop];
|
options[prop] = response[prop];
|
||||||
@@ -3398,11 +3408,15 @@
|
|||||||
_context3.prev = 30;
|
_context3.prev = 30;
|
||||||
_context3.t0 = _context3["catch"](4);
|
_context3.t0 = _context3["catch"](4);
|
||||||
onFinish();
|
onFinish();
|
||||||
code = _context3.t0.code;
|
if (!(_context3.t0 && _context3.t0.name === 'TypeError' && /fetch/i.test(_context3.t0.message))) {
|
||||||
if (_context3.t0.name === 'NetworkError') {
|
_context3.next = 35;
|
||||||
code = AxiosError.ERR_NETWORK;
|
break;
|
||||||
}
|
}
|
||||||
throw AxiosError.from(_context3.t0, code, config, request);
|
throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
|
||||||
|
cause: _context3.t0.cause || _context3.t0
|
||||||
|
});
|
||||||
|
case 35:
|
||||||
|
throw AxiosError.from(_context3.t0, _context3.t0 && _context3.t0.code, config, request);
|
||||||
case 36:
|
case 36:
|
||||||
case "end":
|
case "end":
|
||||||
return _context3.stop();
|
return _context3.stop();
|
||||||
@@ -3412,7 +3426,7 @@
|
|||||||
return function (_x4) {
|
return function (_x4) {
|
||||||
return _ref3.apply(this, arguments);
|
return _ref3.apply(this, arguments);
|
||||||
};
|
};
|
||||||
})());
|
}());
|
||||||
|
|
||||||
var knownAdapters = {
|
var knownAdapters = {
|
||||||
http: httpAdapter,
|
http: httpAdapter,
|
||||||
@@ -3531,7 +3545,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var VERSION = "1.7.0-beta.0";
|
var VERSION = "1.7.0-beta.1";
|
||||||
|
|
||||||
var validators$1 = {};
|
var validators$1 = {};
|
||||||
|
|
||||||
@@ -3656,11 +3670,15 @@
|
|||||||
|
|
||||||
// slice off the Error: ... line
|
// slice off the Error: ... line
|
||||||
stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
||||||
if (!_context.t0.stack) {
|
try {
|
||||||
_context.t0.stack = stack;
|
if (!_context.t0.stack) {
|
||||||
// match without the 2 top stack lines
|
_context.t0.stack = stack;
|
||||||
} else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
// match without the 2 top stack lines
|
||||||
_context.t0.stack += '\n' + stack;
|
} else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||||
|
_context.t0.stack += '\n' + stack;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// ignore the case where "stack" is an un-writable property
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw _context.t0;
|
throw _context.t0;
|
||||||
|
|||||||
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
Vendored
+42
-24
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.7.0-beta.0 Copyright (c) 2024 Matt Zabriskie and contributors
|
// Axios v1.7.0-beta.1 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function bind(fn, thisArg) {
|
function bind(fn, thisArg) {
|
||||||
@@ -2681,8 +2681,9 @@ const fetchProgressDecorator = (total, fn) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const isFetchSupported = typeof fetch !== 'undefined';
|
const isFetchSupported = typeof fetch !== 'undefined';
|
||||||
|
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream !== 'undefined';
|
||||||
|
|
||||||
const supportsRequestStreams = isFetchSupported && (() => {
|
const supportsRequestStream = isReadableStreamSupported && (() => {
|
||||||
let duplexAccessed = false;
|
let duplexAccessed = false;
|
||||||
|
|
||||||
const hasContentType = new Request(platform.origin, {
|
const hasContentType = new Request(platform.origin, {
|
||||||
@@ -2699,15 +2700,26 @@ const supportsRequestStreams = isFetchSupported && (() => {
|
|||||||
|
|
||||||
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
||||||
|
|
||||||
|
const supportsResponseStream = isReadableStreamSupported && !!(()=> {
|
||||||
|
try {
|
||||||
|
return utils$1.isReadableStream(new Response('').body);
|
||||||
|
} catch(err) {
|
||||||
|
// return undefined
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
stream: (res) => res.body
|
stream: supportsResponseStream && ((res) => res.body)
|
||||||
};
|
};
|
||||||
|
|
||||||
isFetchSupported && ['text', 'arrayBuffer', 'blob', 'formData'].forEach(type => [
|
isFetchSupported && (((res) => {
|
||||||
resolvers[type] = utils$1.isFunction(Response.prototype[type]) ? (res) => res[type]() : (_, config) => {
|
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
||||||
throw new AxiosError(`Response type ${type} is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
||||||
}
|
(_, config) => {
|
||||||
]);
|
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})(new Response));
|
||||||
|
|
||||||
const getBodyLength = async (body) => {
|
const getBodyLength = async (body) => {
|
||||||
if(utils$1.isBlob(body)) {
|
if(utils$1.isBlob(body)) {
|
||||||
@@ -2737,7 +2749,7 @@ const resolveBodyLength = async (headers, body) => {
|
|||||||
return length == null ? getBodyLength(body) : length;
|
return length == null ? getBodyLength(body) : length;
|
||||||
};
|
};
|
||||||
|
|
||||||
var fetchAdapter = async (config) => {
|
var fetchAdapter = isFetchSupported && (async (config) => {
|
||||||
let {
|
let {
|
||||||
url,
|
url,
|
||||||
method,
|
method,
|
||||||
@@ -2769,7 +2781,7 @@ var fetchAdapter = async (config) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (onUploadProgress && supportsRequestStreams && method !== 'get' && method !== 'head') {
|
if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head') {
|
||||||
let requestContentLength = await resolveBodyLength(headers, data);
|
let requestContentLength = await resolveBodyLength(headers, data);
|
||||||
|
|
||||||
let _request = new Request(url, {
|
let _request = new Request(url, {
|
||||||
@@ -2808,7 +2820,7 @@ var fetchAdapter = async (config) => {
|
|||||||
|
|
||||||
const isStreamResponse = responseType === 'stream' || responseType === 'response';
|
const isStreamResponse = responseType === 'stream' || responseType === 'response';
|
||||||
|
|
||||||
if (onDownloadProgress || isStreamResponse) {
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
||||||
const options = {};
|
const options = {};
|
||||||
|
|
||||||
Object.getOwnPropertyNames(response).forEach(prop => {
|
Object.getOwnPropertyNames(response).forEach(prop => {
|
||||||
@@ -2847,15 +2859,18 @@ var fetchAdapter = async (config) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
onFinish();
|
onFinish();
|
||||||
|
|
||||||
let {code} = err;
|
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
||||||
|
throw Object.assign(
|
||||||
if (err.name === 'NetworkError') {
|
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
||||||
code = AxiosError.ERR_NETWORK;
|
{
|
||||||
|
cause: err.cause || err
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
throw AxiosError.from(err, code, config, request);
|
throw AxiosError.from(err, err && err.code, config, request);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
const knownAdapters = {
|
const knownAdapters = {
|
||||||
http: httpAdapter,
|
http: httpAdapter,
|
||||||
@@ -3004,7 +3019,7 @@ function dispatchRequest(config) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION = "1.7.0-beta.0";
|
const VERSION = "1.7.0-beta.1";
|
||||||
|
|
||||||
const validators$1 = {};
|
const validators$1 = {};
|
||||||
|
|
||||||
@@ -3130,12 +3145,15 @@ class Axios {
|
|||||||
|
|
||||||
// slice off the Error: ... line
|
// slice off the Error: ... line
|
||||||
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
||||||
|
try {
|
||||||
if (!err.stack) {
|
if (!err.stack) {
|
||||||
err.stack = stack;
|
err.stack = stack;
|
||||||
// match without the 2 top stack lines
|
// match without the 2 top stack lines
|
||||||
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||||
err.stack += '\n' + stack;
|
err.stack += '\n' + stack;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// ignore the case where "stack" is an un-writable property
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+42
-24
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.7.0-beta.0 Copyright (c) 2024 Matt Zabriskie and contributors
|
// Axios v1.7.0-beta.1 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||||
function bind(fn, thisArg) {
|
function bind(fn, thisArg) {
|
||||||
return function wrap() {
|
return function wrap() {
|
||||||
return fn.apply(thisArg, arguments);
|
return fn.apply(thisArg, arguments);
|
||||||
@@ -2679,8 +2679,9 @@ const fetchProgressDecorator = (total, fn) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const isFetchSupported = typeof fetch !== 'undefined';
|
const isFetchSupported = typeof fetch !== 'undefined';
|
||||||
|
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream !== 'undefined';
|
||||||
|
|
||||||
const supportsRequestStreams = isFetchSupported && (() => {
|
const supportsRequestStream = isReadableStreamSupported && (() => {
|
||||||
let duplexAccessed = false;
|
let duplexAccessed = false;
|
||||||
|
|
||||||
const hasContentType = new Request(platform.origin, {
|
const hasContentType = new Request(platform.origin, {
|
||||||
@@ -2697,15 +2698,26 @@ const supportsRequestStreams = isFetchSupported && (() => {
|
|||||||
|
|
||||||
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
||||||
|
|
||||||
|
const supportsResponseStream = isReadableStreamSupported && !!(()=> {
|
||||||
|
try {
|
||||||
|
return utils$1.isReadableStream(new Response('').body);
|
||||||
|
} catch(err) {
|
||||||
|
// return undefined
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
stream: (res) => res.body
|
stream: supportsResponseStream && ((res) => res.body)
|
||||||
};
|
};
|
||||||
|
|
||||||
isFetchSupported && ['text', 'arrayBuffer', 'blob', 'formData'].forEach(type => [
|
isFetchSupported && (((res) => {
|
||||||
resolvers[type] = utils$1.isFunction(Response.prototype[type]) ? (res) => res[type]() : (_, config) => {
|
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
||||||
throw new AxiosError$1(`Response type ${type} is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
||||||
}
|
(_, config) => {
|
||||||
]);
|
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})(new Response));
|
||||||
|
|
||||||
const getBodyLength = async (body) => {
|
const getBodyLength = async (body) => {
|
||||||
if(utils$1.isBlob(body)) {
|
if(utils$1.isBlob(body)) {
|
||||||
@@ -2735,7 +2747,7 @@ const resolveBodyLength = async (headers, body) => {
|
|||||||
return length == null ? getBodyLength(body) : length;
|
return length == null ? getBodyLength(body) : length;
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAdapter = async (config) => {
|
const fetchAdapter = isFetchSupported && (async (config) => {
|
||||||
let {
|
let {
|
||||||
url,
|
url,
|
||||||
method,
|
method,
|
||||||
@@ -2767,7 +2779,7 @@ const fetchAdapter = async (config) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (onUploadProgress && supportsRequestStreams && method !== 'get' && method !== 'head') {
|
if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head') {
|
||||||
let requestContentLength = await resolveBodyLength(headers, data);
|
let requestContentLength = await resolveBodyLength(headers, data);
|
||||||
|
|
||||||
let _request = new Request(url, {
|
let _request = new Request(url, {
|
||||||
@@ -2806,7 +2818,7 @@ const fetchAdapter = async (config) => {
|
|||||||
|
|
||||||
const isStreamResponse = responseType === 'stream' || responseType === 'response';
|
const isStreamResponse = responseType === 'stream' || responseType === 'response';
|
||||||
|
|
||||||
if (onDownloadProgress || isStreamResponse) {
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
||||||
const options = {};
|
const options = {};
|
||||||
|
|
||||||
Object.getOwnPropertyNames(response).forEach(prop => {
|
Object.getOwnPropertyNames(response).forEach(prop => {
|
||||||
@@ -2845,15 +2857,18 @@ const fetchAdapter = async (config) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
onFinish();
|
onFinish();
|
||||||
|
|
||||||
let {code} = err;
|
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
||||||
|
throw Object.assign(
|
||||||
if (err.name === 'NetworkError') {
|
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
||||||
code = AxiosError$1.ERR_NETWORK;
|
{
|
||||||
|
cause: err.cause || err
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
throw AxiosError$1.from(err, code, config, request);
|
throw AxiosError$1.from(err, err && err.code, config, request);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
const knownAdapters = {
|
const knownAdapters = {
|
||||||
http: httpAdapter,
|
http: httpAdapter,
|
||||||
@@ -3002,7 +3017,7 @@ function dispatchRequest(config) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION$1 = "1.7.0-beta.0";
|
const VERSION$1 = "1.7.0-beta.1";
|
||||||
|
|
||||||
const validators$1 = {};
|
const validators$1 = {};
|
||||||
|
|
||||||
@@ -3128,12 +3143,15 @@ class Axios$1 {
|
|||||||
|
|
||||||
// slice off the Error: ... line
|
// slice off the Error: ... line
|
||||||
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
||||||
|
try {
|
||||||
if (!err.stack) {
|
if (!err.stack) {
|
||||||
err.stack = stack;
|
err.stack = stack;
|
||||||
// match without the 2 top stack lines
|
// match without the 2 top stack lines
|
||||||
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||||
err.stack += '\n' + stack;
|
err.stack += '\n' + stack;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// ignore the case where "stack" is an un-writable property
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
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
Vendored
+42
-24
@@ -1,4 +1,4 @@
|
|||||||
// Axios v1.7.0-beta.0 Copyright (c) 2024 Matt Zabriskie and contributors
|
// Axios v1.7.0-beta.1 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const FormData$1 = require('form-data');
|
const FormData$1 = require('form-data');
|
||||||
@@ -2035,7 +2035,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|||||||
return requestedURL;
|
return requestedURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VERSION = "1.7.0-beta.0";
|
const VERSION = "1.7.0-beta.1";
|
||||||
|
|
||||||
function parseProtocol(url) {
|
function parseProtocol(url) {
|
||||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||||
@@ -3750,8 +3750,9 @@ const fetchProgressDecorator = (total, fn) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const isFetchSupported = typeof fetch !== 'undefined';
|
const isFetchSupported = typeof fetch !== 'undefined';
|
||||||
|
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream !== 'undefined';
|
||||||
|
|
||||||
const supportsRequestStreams = isFetchSupported && (() => {
|
const supportsRequestStream = isReadableStreamSupported && (() => {
|
||||||
let duplexAccessed = false;
|
let duplexAccessed = false;
|
||||||
|
|
||||||
const hasContentType = new Request(platform.origin, {
|
const hasContentType = new Request(platform.origin, {
|
||||||
@@ -3768,15 +3769,26 @@ const supportsRequestStreams = isFetchSupported && (() => {
|
|||||||
|
|
||||||
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
||||||
|
|
||||||
|
const supportsResponseStream = isReadableStreamSupported && !!(()=> {
|
||||||
|
try {
|
||||||
|
return utils$1.isReadableStream(new Response('').body);
|
||||||
|
} catch(err) {
|
||||||
|
// return undefined
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
stream: (res) => res.body
|
stream: supportsResponseStream && ((res) => res.body)
|
||||||
};
|
};
|
||||||
|
|
||||||
isFetchSupported && ['text', 'arrayBuffer', 'blob', 'formData'].forEach(type => [
|
isFetchSupported && (((res) => {
|
||||||
resolvers[type] = utils$1.isFunction(Response.prototype[type]) ? (res) => res[type]() : (_, config) => {
|
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
||||||
throw new AxiosError(`Response type ${type} is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
||||||
}
|
(_, config) => {
|
||||||
]);
|
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})(new Response));
|
||||||
|
|
||||||
const getBodyLength = async (body) => {
|
const getBodyLength = async (body) => {
|
||||||
if(utils$1.isBlob(body)) {
|
if(utils$1.isBlob(body)) {
|
||||||
@@ -3806,7 +3818,7 @@ const resolveBodyLength = async (headers, body) => {
|
|||||||
return length == null ? getBodyLength(body) : length;
|
return length == null ? getBodyLength(body) : length;
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAdapter = async (config) => {
|
const fetchAdapter = isFetchSupported && (async (config) => {
|
||||||
let {
|
let {
|
||||||
url,
|
url,
|
||||||
method,
|
method,
|
||||||
@@ -3838,7 +3850,7 @@ const fetchAdapter = async (config) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (onUploadProgress && supportsRequestStreams && method !== 'get' && method !== 'head') {
|
if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head') {
|
||||||
let requestContentLength = await resolveBodyLength(headers, data);
|
let requestContentLength = await resolveBodyLength(headers, data);
|
||||||
|
|
||||||
let _request = new Request(url, {
|
let _request = new Request(url, {
|
||||||
@@ -3877,7 +3889,7 @@ const fetchAdapter = async (config) => {
|
|||||||
|
|
||||||
const isStreamResponse = responseType === 'stream' || responseType === 'response';
|
const isStreamResponse = responseType === 'stream' || responseType === 'response';
|
||||||
|
|
||||||
if (onDownloadProgress || isStreamResponse) {
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
||||||
const options = {};
|
const options = {};
|
||||||
|
|
||||||
Object.getOwnPropertyNames(response).forEach(prop => {
|
Object.getOwnPropertyNames(response).forEach(prop => {
|
||||||
@@ -3916,15 +3928,18 @@ const fetchAdapter = async (config) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
onFinish();
|
onFinish();
|
||||||
|
|
||||||
let {code} = err;
|
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
||||||
|
throw Object.assign(
|
||||||
if (err.name === 'NetworkError') {
|
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
||||||
code = AxiosError.ERR_NETWORK;
|
{
|
||||||
|
cause: err.cause || err
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
throw AxiosError.from(err, code, config, request);
|
throw AxiosError.from(err, err && err.code, config, request);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
const knownAdapters = {
|
const knownAdapters = {
|
||||||
http: httpAdapter,
|
http: httpAdapter,
|
||||||
@@ -4197,12 +4212,15 @@ class Axios {
|
|||||||
|
|
||||||
// slice off the Error: ... line
|
// slice off the Error: ... line
|
||||||
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
||||||
|
try {
|
||||||
if (!err.stack) {
|
if (!err.stack) {
|
||||||
err.stack = stack;
|
err.stack = stack;
|
||||||
// match without the 2 top stack lines
|
// match without the 2 top stack lines
|
||||||
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
||||||
err.stack += '\n' + stack;
|
err.stack += '\n' + stack;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// ignore the case where "stack" is an un-writable property
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
export const VERSION = "1.7.0-beta.0";
|
export const VERSION = "1.7.0-beta.1";
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "1.7.0-beta.0",
|
"version": "1.7.0-beta.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "1.7.0-beta.0",
|
"version": "1.7.0-beta.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.6",
|
"follow-redirects": "^1.15.6",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "axios",
|
"name": "axios",
|
||||||
"version": "1.7.0-beta.0",
|
"version": "1.7.0-beta.1",
|
||||||
"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",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
Reference in New Issue
Block a user