Skip to content

Commit

Permalink
chore(release): v1.7.0-beta.1 (#6383)
Browse files Browse the repository at this point in the history
Co-authored-by: DigitalBrainJS <DigitalBrainJS@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and DigitalBrainJS committed May 7, 2024
1 parent bb5f9a5 commit b9f4848
Show file tree
Hide file tree
Showing 17 changed files with 197 additions and 111 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,19 @@
# 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&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Alexandre ABRIOUX](https://github.com/alexandre-abrioux "+56/-6 (#6362 )")
- <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 )")

# [1.7.0-beta.0](https://github.com/axios/axios/compare/v1.6.8...v1.7.0-beta.0) (2024-04-28)


Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,7 +1,7 @@
{
"name": "axios",
"main": "./dist/axios.js",
"version": "1.7.0-beta.0",
"version": "1.7.0-beta.1",
"homepage": "https://axios-http.com",
"authors": [
"Matt Zabriskie"
Expand Down
68 changes: 43 additions & 25 deletions dist/axios.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/axios.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/axios.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/axios.min.js.map

Large diffs are not rendered by default.

66 changes: 42 additions & 24 deletions dist/browser/axios.cjs
@@ -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';

function bind(fn, thisArg) {
Expand Down Expand Up @@ -2681,8 +2681,9 @@ const fetchProgressDecorator = (total, fn) => {
};

const isFetchSupported = typeof fetch !== 'undefined';
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream !== 'undefined';

const supportsRequestStreams = isFetchSupported && (() => {
const supportsRequestStream = isReadableStreamSupported && (() => {
let duplexAccessed = false;

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

const DEFAULT_CHUNK_SIZE = 64 * 1024;

const supportsResponseStream = isReadableStreamSupported && !!(()=> {
try {
return utils$1.isReadableStream(new Response('').body);
} catch(err) {
// return undefined
}
})();

const resolvers = {
stream: (res) => res.body
stream: supportsResponseStream && ((res) => res.body)
};

isFetchSupported && ['text', 'arrayBuffer', 'blob', 'formData'].forEach(type => [
resolvers[type] = utils$1.isFunction(Response.prototype[type]) ? (res) => res[type]() : (_, config) => {
throw new AxiosError(`Response type ${type} is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
}
]);
isFetchSupported && (((res) => {
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
!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) => {
if(utils$1.isBlob(body)) {
Expand Down Expand Up @@ -2737,7 +2749,7 @@ const resolveBodyLength = async (headers, body) => {
return length == null ? getBodyLength(body) : length;
};

var fetchAdapter = async (config) => {
var fetchAdapter = isFetchSupported && (async (config) => {
let {
url,
method,
Expand Down Expand Up @@ -2769,7 +2781,7 @@ var fetchAdapter = async (config) => {
};

try {
if (onUploadProgress && supportsRequestStreams && method !== 'get' && method !== 'head') {
if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head') {
let requestContentLength = await resolveBodyLength(headers, data);

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

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

if (onDownloadProgress || isStreamResponse) {
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
const options = {};

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

let {code} = err;

if (err.name === 'NetworkError') {
code = AxiosError.ERR_NETWORK;
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
throw Object.assign(
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
{
cause: err.cause || err
}
)
}

throw AxiosError.from(err, code, config, request);
throw AxiosError.from(err, err && err.code, config, request);
}
};
});

const knownAdapters = {
http: httpAdapter,
Expand Down Expand Up @@ -3004,7 +3019,7 @@ function dispatchRequest(config) {
});
}

const VERSION = "1.7.0-beta.0";
const VERSION = "1.7.0-beta.1";

const validators$1 = {};

Expand Down Expand Up @@ -3130,12 +3145,15 @@ class Axios {

// slice off the Error: ... line
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';

if (!err.stack) {
err.stack = stack;
// match without the 2 top stack lines
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
err.stack += '\n' + stack;
try {
if (!err.stack) {
err.stack = stack;
// match without the 2 top stack lines
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
err.stack += '\n' + stack;
}
} catch (e) {
// ignore the case where "stack" is an un-writable property
}
}

Expand Down
2 changes: 1 addition & 1 deletion dist/browser/axios.cjs.map

Large diffs are not rendered by default.

0 comments on commit b9f4848

Please sign in to comment.