Skip to content

Commit b9f4848

Browse files
chore(release): v1.7.0-beta.1 (#6383)
Co-authored-by: DigitalBrainJS <[email protected]>
1 parent bb5f9a5 commit b9f4848

File tree

17 files changed

+197
-111
lines changed

17 files changed

+197
-111
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
# [1.7.0-beta.1](https://github.com/axios/axios/compare/v1.7.0-beta.0...v1.7.0-beta.1) (2024-05-07)
4+
5+
6+
### Bug Fixes
7+
8+
* **core/axios:** handle un-writable error stack ([#6362](https://github.com/axios/axios/issues/6362)) ([81e0455](https://github.com/axios/axios/commit/81e0455b7b57fbaf2be16a73ebe0e6591cc6d8f9))
9+
* **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))
10+
* **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))
11+
12+
### Contributors to this release
13+
14+
- <img src="https://avatars.githubusercontent.com/u/16711696?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Alexandre ABRIOUX](https://github.com/alexandre-abrioux "+56/-6 (#6362 )")
15+
- <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+42/-17 (#6380 #6377 )")
16+
317
# [1.7.0-beta.0](https://github.com/axios/axios/compare/v1.6.8...v1.7.0-beta.0) (2024-04-28)
418

519

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "axios",
33
"main": "./dist/axios.js",
4-
"version": "1.7.0-beta.0",
4+
"version": "1.7.0-beta.1",
55
"homepage": "https://axios-http.com",
66
"authors": [
77
"Matt Zabriskie"

dist/axios.js

Lines changed: 43 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/axios.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/axios.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/axios.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/browser/axios.cjs

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Axios v1.7.0-beta.0 Copyright (c) 2024 Matt Zabriskie and contributors
1+
// Axios v1.7.0-beta.1 Copyright (c) 2024 Matt Zabriskie and contributors
22
'use strict';
33

44
function bind(fn, thisArg) {
@@ -2681,8 +2681,9 @@ const fetchProgressDecorator = (total, fn) => {
26812681
};
26822682

26832683
const isFetchSupported = typeof fetch !== 'undefined';
2684+
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream !== 'undefined';
26842685

2685-
const supportsRequestStreams = isFetchSupported && (() => {
2686+
const supportsRequestStream = isReadableStreamSupported && (() => {
26862687
let duplexAccessed = false;
26872688

26882689
const hasContentType = new Request(platform.origin, {
@@ -2699,15 +2700,26 @@ const supportsRequestStreams = isFetchSupported && (() => {
26992700

27002701
const DEFAULT_CHUNK_SIZE = 64 * 1024;
27012702

2703+
const supportsResponseStream = isReadableStreamSupported && !!(()=> {
2704+
try {
2705+
return utils$1.isReadableStream(new Response('').body);
2706+
} catch(err) {
2707+
// return undefined
2708+
}
2709+
})();
2710+
27022711
const resolvers = {
2703-
stream: (res) => res.body
2712+
stream: supportsResponseStream && ((res) => res.body)
27042713
};
27052714

2706-
isFetchSupported && ['text', 'arrayBuffer', 'blob', 'formData'].forEach(type => [
2707-
resolvers[type] = utils$1.isFunction(Response.prototype[type]) ? (res) => res[type]() : (_, config) => {
2708-
throw new AxiosError(`Response type ${type} is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
2709-
}
2710-
]);
2715+
isFetchSupported && (((res) => {
2716+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2717+
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
2718+
(_, config) => {
2719+
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
2720+
});
2721+
});
2722+
})(new Response));
27112723

27122724
const getBodyLength = async (body) => {
27132725
if(utils$1.isBlob(body)) {
@@ -2737,7 +2749,7 @@ const resolveBodyLength = async (headers, body) => {
27372749
return length == null ? getBodyLength(body) : length;
27382750
};
27392751

2740-
var fetchAdapter = async (config) => {
2752+
var fetchAdapter = isFetchSupported && (async (config) => {
27412753
let {
27422754
url,
27432755
method,
@@ -2769,7 +2781,7 @@ var fetchAdapter = async (config) => {
27692781
};
27702782

27712783
try {
2772-
if (onUploadProgress && supportsRequestStreams && method !== 'get' && method !== 'head') {
2784+
if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head') {
27732785
let requestContentLength = await resolveBodyLength(headers, data);
27742786

27752787
let _request = new Request(url, {
@@ -2808,7 +2820,7 @@ var fetchAdapter = async (config) => {
28082820

28092821
const isStreamResponse = responseType === 'stream' || responseType === 'response';
28102822

2811-
if (onDownloadProgress || isStreamResponse) {
2823+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
28122824
const options = {};
28132825

28142826
Object.getOwnPropertyNames(response).forEach(prop => {
@@ -2847,15 +2859,18 @@ var fetchAdapter = async (config) => {
28472859
} catch (err) {
28482860
onFinish();
28492861

2850-
let {code} = err;
2851-
2852-
if (err.name === 'NetworkError') {
2853-
code = AxiosError.ERR_NETWORK;
2862+
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
2863+
throw Object.assign(
2864+
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
2865+
{
2866+
cause: err.cause || err
2867+
}
2868+
)
28542869
}
28552870

2856-
throw AxiosError.from(err, code, config, request);
2871+
throw AxiosError.from(err, err && err.code, config, request);
28572872
}
2858-
};
2873+
});
28592874

28602875
const knownAdapters = {
28612876
http: httpAdapter,
@@ -3004,7 +3019,7 @@ function dispatchRequest(config) {
30043019
});
30053020
}
30063021

3007-
const VERSION = "1.7.0-beta.0";
3022+
const VERSION = "1.7.0-beta.1";
30083023

30093024
const validators$1 = {};
30103025

@@ -3130,12 +3145,15 @@ class Axios {
31303145

31313146
// slice off the Error: ... line
31323147
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3133-
3134-
if (!err.stack) {
3135-
err.stack = stack;
3136-
// match without the 2 top stack lines
3137-
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3138-
err.stack += '\n' + stack;
3148+
try {
3149+
if (!err.stack) {
3150+
err.stack = stack;
3151+
// match without the 2 top stack lines
3152+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3153+
err.stack += '\n' + stack;
3154+
}
3155+
} catch (e) {
3156+
// ignore the case where "stack" is an un-writable property
31393157
}
31403158
}
31413159

dist/browser/axios.cjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)