chore(release): v1.7.5 (#6574)

Co-authored-by: DigitalBrainJS <12586868+DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2024-08-23 16:31:50 +03:00 committed by GitHub
parent 6700a8adac
commit 59cd6b0dec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 110 additions and 66 deletions

View File

@ -1,5 +1,21 @@
# Changelog
## [1.7.5](https://github.com/axios/axios/compare/v1.7.4...v1.7.5) (2024-08-23)
### Bug Fixes
* **adapter:** fix undefined reference to hasBrowserEnv ([#6572](https://github.com/axios/axios/issues/6572)) ([7004707](https://github.com/axios/axios/commit/7004707c4180b416341863bd86913fe4fc2f1df1))
* **core:** add the missed implementation of AxiosError#status property; ([#6573](https://github.com/axios/axios/issues/6573)) ([6700a8a](https://github.com/axios/axios/commit/6700a8adac06942205f6a7a21421ecb36c4e0852))
* **core:** fix `ReferenceError: navigator is not defined` for custom environments; ([#6567](https://github.com/axios/axios/issues/6567)) ([fed1a4b](https://github.com/axios/axios/commit/fed1a4b2d78ed4a588c84e09d32749ed01dc2794))
* **fetch:** fix credentials handling in Cloudflare workers ([#6533](https://github.com/axios/axios/issues/6533)) ([550d885](https://github.com/axios/axios/commit/550d885eb90fd156add7b93bbdc54d30d2f9a98d))
### Contributors to this release
- <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 "+187/-83 (#6573 #6567 #6566 #6564 #6563 #6557 #6556 #6555 #6554 #6552 )")
- <img src="https://avatars.githubusercontent.com/u/2495809?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Antonin Bas](https://github.com/antoninbas "+6/-6 (#6572 )")
- <img src="https://avatars.githubusercontent.com/u/5406212?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Hans Otto Wirtz](https://github.com/hansottowirtz "+4/-1 (#6533 )")
## [1.7.4](https://github.com/axios/axios/compare/v1.7.3...v1.7.4) (2024-08-13)

View File

@ -1,7 +1,7 @@
{
"name": "axios",
"main": "./dist/axios.js",
"version": "1.7.4",
"version": "1.7.5",
"homepage": "https://axios-http.com",
"authors": [
"Matt Zabriskie"

51
dist/axios.js vendored
View File

@ -1,4 +1,4 @@
// Axios v1.7.4 Copyright (c) 2024 Matt Zabriskie and contributors
// Axios v1.7.5 Copyright (c) 2024 Matt Zabriskie and contributors
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
@ -1432,7 +1432,10 @@
code && (this.code = code);
config && (this.config = config);
request && (this.request = request);
response && (this.response = response);
if (response) {
this.response = response;
this.status = response.status ? response.status : null;
}
}
utils$1.inherits(AxiosError, Error, {
toJSON: function toJSON() {
@ -1451,7 +1454,7 @@
// Axios
config: utils$1.toJSONObject(this.config),
code: this.code,
status: this.response && this.response.status ? this.response.status : null
status: this.status
};
}
});
@ -1860,6 +1863,7 @@
};
var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && navigator || undefined;
/**
* Determine if we're running in a standard browser environment
@ -1878,9 +1882,7 @@
*
* @returns {boolean}
*/
var hasStandardBrowserEnv = function (product) {
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0;
}(typeof navigator !== 'undefined' && navigator.product);
var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
/**
* Determine if we're running in a standard browser webWorker environment
@ -1903,6 +1905,7 @@
hasBrowserEnv: hasBrowserEnv,
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
hasStandardBrowserEnv: hasStandardBrowserEnv,
navigator: _navigator,
origin: origin
});
@ -2643,7 +2646,7 @@
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
function standardBrowserEnv() {
var msie = /(msie|trident)/i.test(navigator.userAgent);
var msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
var urlParsingNode = document.createElement('a');
var originURL;
@ -3445,7 +3448,7 @@
}();
var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref5, _ref6, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, response, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, responseData;
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref5, _ref6, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, response, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, responseData;
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
@ -3490,17 +3493,21 @@
if (!utils$1.isString(withCredentials)) {
withCredentials = withCredentials ? 'include' : 'omit';
}
// Cloudflare Workers throws when credentials are defined
// see https://github.com/cloudflare/workerd/issues/902
isCredentialsSupported = "credentials" in Request.prototype;
request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
signal: composedSignal,
method: method.toUpperCase(),
headers: headers.normalize().toJSON(),
body: data,
duplex: "half",
credentials: withCredentials
credentials: isCredentialsSupported ? withCredentials : undefined
}));
_context4.next = 19;
_context4.next = 20;
return fetch(request);
case 19:
case 20:
response = _context4.sent;
isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
@ -3516,13 +3523,13 @@
}, encodeText), options);
}
responseType = responseType || 'text';
_context4.next = 25;
_context4.next = 26;
return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
case 25:
case 26:
responseData = _context4.sent;
!isStreamResponse && onFinish();
stopTimeout && stopTimeout();
_context4.next = 30;
_context4.next = 31;
return new Promise(function (resolve, reject) {
settle(resolve, reject, {
data: responseData,
@ -3533,26 +3540,26 @@
request: request
});
});
case 30:
case 31:
return _context4.abrupt("return", _context4.sent);
case 33:
_context4.prev = 33;
case 34:
_context4.prev = 34;
_context4.t2 = _context4["catch"](4);
onFinish();
if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) {
_context4.next = 38;
_context4.next = 39;
break;
}
throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
cause: _context4.t2.cause || _context4.t2
});
case 38:
throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
case 39:
throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
case 40:
case "end":
return _context4.stop();
}
}, _callee4, null, [[4, 33]]);
}, _callee4, null, [[4, 34]]);
}));
return function (_x5) {
return _ref4.apply(this, arguments);
@ -3676,7 +3683,7 @@
});
}
var VERSION = "1.7.4";
var VERSION = "1.7.5";
var validators$1 = {};

2
dist/axios.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/axios.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
// Axios v1.7.4 Copyright (c) 2024 Matt Zabriskie and contributors
// Axios v1.7.5 Copyright (c) 2024 Matt Zabriskie and contributors
'use strict';
function bind(fn, thisArg) {
@ -789,7 +789,10 @@ function AxiosError(message, code, config, request, response) {
code && (this.code = code);
config && (this.config = config);
request && (this.request = request);
response && (this.response = response);
if (response) {
this.response = response;
this.status = response.status ? response.status : null;
}
}
utils$1.inherits(AxiosError, Error, {
@ -809,7 +812,7 @@ utils$1.inherits(AxiosError, Error, {
// Axios
config: utils$1.toJSONObject(this.config),
code: this.code,
status: this.response && this.response.status ? this.response.status : null
status: this.status
};
}
});
@ -1277,6 +1280,8 @@ var platform$1 = {
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
const _navigator = typeof navigator === 'object' && navigator || undefined;
/**
* Determine if we're running in a standard browser environment
*
@ -1294,10 +1299,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
*
* @returns {boolean}
*/
const hasStandardBrowserEnv = (
(product) => {
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
})(typeof navigator !== 'undefined' && navigator.product);
const hasStandardBrowserEnv = hasBrowserEnv &&
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
/**
* Determine if we're running in a standard browser webWorker environment
@ -1324,6 +1327,7 @@ var utils = /*#__PURE__*/Object.freeze({
hasBrowserEnv: hasBrowserEnv,
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
hasStandardBrowserEnv: hasStandardBrowserEnv,
navigator: _navigator,
origin: origin
});
@ -2153,7 +2157,7 @@ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
(function standardBrowserEnv() {
const msie = /(msie|trident)/i.test(navigator.userAgent);
const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
const urlParsingNode = document.createElement('a');
let originURL;
@ -2890,6 +2894,9 @@ var fetchAdapter = isFetchSupported && (async (config) => {
withCredentials = withCredentials ? 'include' : 'omit';
}
// Cloudflare Workers throws when credentials are defined
// see https://github.com/cloudflare/workerd/issues/902
const isCredentialsSupported = "credentials" in Request.prototype;
request = new Request(url, {
...fetchOptions,
signal: composedSignal,
@ -2897,7 +2904,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
headers: headers.normalize().toJSON(),
body: data,
duplex: "half",
credentials: withCredentials
credentials: isCredentialsSupported ? withCredentials : undefined
});
let response = await fetch(request);
@ -3108,7 +3115,7 @@ function dispatchRequest(config) {
});
}
const VERSION = "1.7.4";
const VERSION = "1.7.5";
const validators$1 = {};

File diff suppressed because one or more lines are too long

27
dist/esm/axios.js vendored
View File

@ -1,4 +1,4 @@
// Axios v1.7.4 Copyright (c) 2024 Matt Zabriskie and contributors
// Axios v1.7.5 Copyright (c) 2024 Matt Zabriskie and contributors
function bind(fn, thisArg) {
return function wrap() {
return fn.apply(thisArg, arguments);
@ -787,7 +787,10 @@ function AxiosError$1(message, code, config, request, response) {
code && (this.code = code);
config && (this.config = config);
request && (this.request = request);
response && (this.response = response);
if (response) {
this.response = response;
this.status = response.status ? response.status : null;
}
}
utils$1.inherits(AxiosError$1, Error, {
@ -807,7 +810,7 @@ utils$1.inherits(AxiosError$1, Error, {
// Axios
config: utils$1.toJSONObject(this.config),
code: this.code,
status: this.response && this.response.status ? this.response.status : null
status: this.status
};
}
});
@ -1275,6 +1278,8 @@ const platform$1 = {
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
const _navigator = typeof navigator === 'object' && navigator || undefined;
/**
* Determine if we're running in a standard browser environment
*
@ -1292,10 +1297,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
*
* @returns {boolean}
*/
const hasStandardBrowserEnv = (
(product) => {
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
})(typeof navigator !== 'undefined' && navigator.product);
const hasStandardBrowserEnv = hasBrowserEnv &&
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
/**
* Determine if we're running in a standard browser webWorker environment
@ -1322,6 +1325,7 @@ const utils = /*#__PURE__*/Object.freeze({
hasBrowserEnv: hasBrowserEnv,
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
hasStandardBrowserEnv: hasStandardBrowserEnv,
navigator: _navigator,
origin: origin
});
@ -2151,7 +2155,7 @@ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
(function standardBrowserEnv() {
const msie = /(msie|trident)/i.test(navigator.userAgent);
const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
const urlParsingNode = document.createElement('a');
let originURL;
@ -2888,6 +2892,9 @@ const fetchAdapter = isFetchSupported && (async (config) => {
withCredentials = withCredentials ? 'include' : 'omit';
}
// Cloudflare Workers throws when credentials are defined
// see https://github.com/cloudflare/workerd/issues/902
const isCredentialsSupported = "credentials" in Request.prototype;
request = new Request(url, {
...fetchOptions,
signal: composedSignal,
@ -2895,7 +2902,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
headers: headers.normalize().toJSON(),
body: data,
duplex: "half",
credentials: withCredentials
credentials: isCredentialsSupported ? withCredentials : undefined
});
let response = await fetch(request);
@ -3106,7 +3113,7 @@ function dispatchRequest(config) {
});
}
const VERSION$1 = "1.7.4";
const VERSION$1 = "1.7.5";
const validators$1 = {};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

29
dist/node/axios.cjs vendored
View File

@ -1,4 +1,4 @@
// Axios v1.7.4 Copyright (c) 2024 Matt Zabriskie and contributors
// Axios v1.7.5 Copyright (c) 2024 Matt Zabriskie and contributors
'use strict';
const FormData$1 = require('form-data');
@ -811,7 +811,10 @@ function AxiosError(message, code, config, request, response) {
code && (this.code = code);
config && (this.config = config);
request && (this.request = request);
response && (this.response = response);
if (response) {
this.response = response;
this.status = response.status ? response.status : null;
}
}
utils$1.inherits(AxiosError, Error, {
@ -831,7 +834,7 @@ utils$1.inherits(AxiosError, Error, {
// Axios
config: utils$1.toJSONObject(this.config),
code: this.code,
status: this.response && this.response.status ? this.response.status : null
status: this.status
};
}
});
@ -1292,6 +1295,8 @@ const platform$1 = {
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
const _navigator = typeof navigator === 'object' && navigator || undefined;
/**
* Determine if we're running in a standard browser environment
*
@ -1309,10 +1314,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
*
* @returns {boolean}
*/
const hasStandardBrowserEnv = (
(product) => {
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
})(typeof navigator !== 'undefined' && navigator.product);
const hasStandardBrowserEnv = hasBrowserEnv &&
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
/**
* Determine if we're running in a standard browser webWorker environment
@ -1339,6 +1342,7 @@ const utils = /*#__PURE__*/Object.freeze({
hasBrowserEnv: hasBrowserEnv,
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
hasStandardBrowserEnv: hasStandardBrowserEnv,
navigator: _navigator,
origin: origin
});
@ -2067,7 +2071,7 @@ function buildFullPath(baseURL, requestedURL) {
return requestedURL;
}
const VERSION = "1.7.4";
const VERSION = "1.7.5";
function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@ -2763,7 +2767,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
// Parse url
const fullPath = buildFullPath(config.baseURL, config.url);
const parsed = new URL(fullPath, utils$1.hasBrowserEnv ? platform.origin : undefined);
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
const protocol = parsed.protocol || supportedProtocols[0];
if (protocol === 'data:') {
@ -3229,7 +3233,7 @@ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
(function standardBrowserEnv() {
const msie = /(msie|trident)/i.test(navigator.userAgent);
const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
const urlParsingNode = document.createElement('a');
let originURL;
@ -3921,6 +3925,9 @@ const fetchAdapter = isFetchSupported && (async (config) => {
withCredentials = withCredentials ? 'include' : 'omit';
}
// Cloudflare Workers throws when credentials are defined
// see https://github.com/cloudflare/workerd/issues/902
const isCredentialsSupported = "credentials" in Request.prototype;
request = new Request(url, {
...fetchOptions,
signal: composedSignal,
@ -3928,7 +3935,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
headers: headers.normalize().toJSON(),
body: data,
duplex: "half",
credentials: withCredentials
credentials: isCredentialsSupported ? withCredentials : undefined
});
let response = await fetch(request);

File diff suppressed because one or more lines are too long

2
lib/env/data.js vendored
View File

@ -1 +1 @@
export const VERSION = "1.7.4";
export const VERSION = "1.7.5";

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "axios",
"version": "1.7.4",
"version": "1.7.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "axios",
"version": "1.7.4",
"version": "1.7.5",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.6",

View File

@ -1,6 +1,6 @@
{
"name": "axios",
"version": "1.7.4",
"version": "1.7.5",
"description": "Promise based HTTP client for the browser and node.js",
"main": "index.js",
"exports": {