2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

chore(release): v1.7.7 (#6585)

Co-authored-by: DigitalBrainJS <12586868+DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2024-09-01 01:01:25 +03:00
committed by GitHub
parent 364993f0d8
commit 5b8a826771
17 changed files with 211 additions and 109 deletions
+13
View File
@@ -1,5 +1,18 @@
# Changelog # Changelog
## [1.7.7](https://github.com/axios/axios/compare/v1.7.6...v1.7.7) (2024-08-31)
### Bug Fixes
* **fetch:** fix stream handling in Safari by fallback to using a stream reader instead of an async iterator; ([#6584](https://github.com/axios/axios/issues/6584)) ([d198085](https://github.com/axios/axios/commit/d1980854fee1765cd02fa0787adf5d6e34dd9dcf))
* **http:** fixed support for IPv6 literal strings in url ([#5731](https://github.com/axios/axios/issues/5731)) ([364993f](https://github.com/axios/axios/commit/364993f0d8bc6e0e06f76b8a35d2d0a35cab054c))
### Contributors to this release
- <img src="https://avatars.githubusercontent.com/u/10539109?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Rishi556](https://github.com/Rishi556 "+39/-1 (#5731 )")
- <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 "+27/-7 (#6584 )")
## [1.7.6](https://github.com/axios/axios/compare/v1.7.5...v1.7.6) (2024-08-30) ## [1.7.6](https://github.com/axios/axios/compare/v1.7.5...v1.7.6) (2024-08-30)
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "axios", "name": "axios",
"main": "./dist/axios.js", "main": "./dist/axios.js",
"version": "1.7.6", "version": "1.7.7",
"homepage": "https://axios-http.com", "homepage": "https://axios-http.com",
"authors": [ "authors": [
"Matt Zabriskie" "Matt Zabriskie"
+97 -68
View File
@@ -1,4 +1,4 @@
// Axios v1.7.6 Copyright (c) 2024 Matt Zabriskie and contributors // Axios v1.7.7 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) :
@@ -3167,7 +3167,7 @@
}, streamChunk); }, streamChunk);
}); });
var readBytes = /*#__PURE__*/function () { var readBytes = /*#__PURE__*/function () {
var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize, encode) { var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize) {
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk; var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
return _regeneratorRuntime().wrap(function _callee$(_context2) { return _regeneratorRuntime().wrap(function _callee$(_context2) {
while (1) switch (_context2.prev = _context2.next) { while (1) switch (_context2.prev = _context2.next) {
@@ -3175,82 +3175,111 @@
_iteratorAbruptCompletion = false; _iteratorAbruptCompletion = false;
_didIteratorError = false; _didIteratorError = false;
_context2.prev = 2; _context2.prev = 2;
_iterator = _asyncIterator(iterable); _iterator = _asyncIterator(readStream(iterable));
case 4: case 4:
_context2.next = 6; _context2.next = 6;
return _awaitAsyncGenerator(_iterator.next()); return _awaitAsyncGenerator(_iterator.next());
case 6: case 6:
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) { if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
_context2.next = 27; _context2.next = 12;
break; break;
} }
chunk = _step.value; chunk = _step.value;
_context2.t0 = _asyncGeneratorDelegate; return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize))), "t0", 9);
_context2.t1 = _asyncIterator; case 9:
_context2.t2 = streamChunk;
if (!ArrayBuffer.isView(chunk)) {
_context2.next = 15;
break;
}
_context2.t3 = chunk;
_context2.next = 18;
break;
case 15:
_context2.next = 17;
return _awaitAsyncGenerator(encode(String(chunk)));
case 17:
_context2.t3 = _context2.sent;
case 18:
_context2.t4 = _context2.t3;
_context2.t5 = chunkSize;
_context2.t6 = (0, _context2.t2)(_context2.t4, _context2.t5);
_context2.t7 = (0, _context2.t1)(_context2.t6);
_context2.t8 = _awaitAsyncGenerator;
return _context2.delegateYield((0, _context2.t0)(_context2.t7, _context2.t8), "t9", 24);
case 24:
_iteratorAbruptCompletion = false; _iteratorAbruptCompletion = false;
_context2.next = 4; _context2.next = 4;
break; break;
case 27: case 12:
_context2.next = 33; _context2.next = 18;
break; break;
case 29: case 14:
_context2.prev = 29; _context2.prev = 14;
_context2.t10 = _context2["catch"](2); _context2.t1 = _context2["catch"](2);
_didIteratorError = true; _didIteratorError = true;
_iteratorError = _context2.t10; _iteratorError = _context2.t1;
case 33: case 18:
_context2.prev = 33; _context2.prev = 18;
_context2.prev = 34; _context2.prev = 19;
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) { if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
_context2.next = 38; _context2.next = 23;
break; break;
} }
_context2.next = 38; _context2.next = 23;
return _awaitAsyncGenerator(_iterator["return"]()); return _awaitAsyncGenerator(_iterator["return"]());
case 38: case 23:
_context2.prev = 38; _context2.prev = 23;
if (!_didIteratorError) { if (!_didIteratorError) {
_context2.next = 41; _context2.next = 26;
break; break;
} }
throw _iteratorError; throw _iteratorError;
case 41: case 26:
return _context2.finish(38); return _context2.finish(23);
case 42: case 27:
return _context2.finish(33); return _context2.finish(18);
case 43: case 28:
case "end": case "end":
return _context2.stop(); return _context2.stop();
} }
}, _callee, null, [[2, 29, 33, 43], [34,, 38, 42]]); }, _callee, null, [[2, 14, 18, 28], [19,, 23, 27]]);
})); }));
return function readBytes(_x, _x2, _x3) { return function readBytes(_x, _x2) {
return _ref.apply(this, arguments); return _ref.apply(this, arguments);
}; };
}(); }();
var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish, encode) { var readStream = /*#__PURE__*/function () {
var iterator = readBytes(stream, chunkSize, encode); var _ref2 = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(stream) {
var reader, _yield$_awaitAsyncGen, done, value;
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
if (!stream[Symbol.asyncIterator]) {
_context3.next = 3;
break;
}
return _context3.delegateYield(_asyncGeneratorDelegate(_asyncIterator(stream)), "t0", 2);
case 2:
return _context3.abrupt("return");
case 3:
reader = stream.getReader();
_context3.prev = 4;
case 5:
_context3.next = 7;
return _awaitAsyncGenerator(reader.read());
case 7:
_yield$_awaitAsyncGen = _context3.sent;
done = _yield$_awaitAsyncGen.done;
value = _yield$_awaitAsyncGen.value;
if (!done) {
_context3.next = 12;
break;
}
return _context3.abrupt("break", 16);
case 12:
_context3.next = 14;
return value;
case 14:
_context3.next = 5;
break;
case 16:
_context3.prev = 16;
_context3.next = 19;
return _awaitAsyncGenerator(reader.cancel());
case 19:
return _context3.finish(16);
case 20:
case "end":
return _context3.stop();
}
}, _callee2, null, [[4,, 16, 20]]);
}));
return function readStream(_x3) {
return _ref2.apply(this, arguments);
};
}();
var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish) {
var iterator = readBytes(stream, chunkSize);
var bytes = 0; var bytes = 0;
var done; var done;
var _onFinish = function _onFinish(e) { var _onFinish = function _onFinish(e) {
@@ -3261,25 +3290,25 @@
}; };
return new ReadableStream({ return new ReadableStream({
pull: function pull(controller) { pull: function pull(controller) {
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
var _yield$iterator$next, _done, value, len, loadedBytes; var _yield$iterator$next, _done, value, len, loadedBytes;
return _regeneratorRuntime().wrap(function _callee2$(_context3) { return _regeneratorRuntime().wrap(function _callee3$(_context4) {
while (1) switch (_context3.prev = _context3.next) { while (1) switch (_context4.prev = _context4.next) {
case 0: case 0:
_context3.prev = 0; _context4.prev = 0;
_context3.next = 3; _context4.next = 3;
return iterator.next(); return iterator.next();
case 3: case 3:
_yield$iterator$next = _context3.sent; _yield$iterator$next = _context4.sent;
_done = _yield$iterator$next.done; _done = _yield$iterator$next.done;
value = _yield$iterator$next.value; value = _yield$iterator$next.value;
if (!_done) { if (!_done) {
_context3.next = 10; _context4.next = 10;
break; break;
} }
_onFinish(); _onFinish();
controller.close(); controller.close();
return _context3.abrupt("return"); return _context4.abrupt("return");
case 10: case 10:
len = value.byteLength; len = value.byteLength;
if (onProgress) { if (onProgress) {
@@ -3287,18 +3316,18 @@
onProgress(loadedBytes); onProgress(loadedBytes);
} }
controller.enqueue(new Uint8Array(value)); controller.enqueue(new Uint8Array(value));
_context3.next = 19; _context4.next = 19;
break; break;
case 15: case 15:
_context3.prev = 15; _context4.prev = 15;
_context3.t0 = _context3["catch"](0); _context4.t0 = _context4["catch"](0);
_onFinish(_context3.t0); _onFinish(_context4.t0);
throw _context3.t0; throw _context4.t0;
case 19: case 19:
case "end": case "end":
return _context3.stop(); return _context4.stop();
} }
}, _callee2, null, [[0, 15]]); }, _callee3, null, [[0, 15]]);
}))(); }))();
}, },
cancel: function cancel(reason) { cancel: function cancel(reason) {
@@ -3493,7 +3522,7 @@
} }
if (_request.body) { if (_request.body) {
_progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1]; _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText); data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
} }
case 15: case 15:
if (!utils$1.isString(withCredentials)) { if (!utils$1.isString(withCredentials)) {
@@ -3526,7 +3555,7 @@
response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () { response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
_flush && _flush(); _flush && _flush();
unsubscribe && unsubscribe(); unsubscribe && unsubscribe();
}, encodeText), options); }), options);
} }
responseType = responseType || 'text'; responseType = responseType || 'text';
_context4.next = 26; _context4.next = 26;
@@ -3688,7 +3717,7 @@
}); });
} }
var VERSION = "1.7.6"; var VERSION = "1.7.7";
var validators$1 = {}; var validators$1 = {};
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+29 -9
View File
@@ -1,4 +1,4 @@
// Axios v1.7.6 Copyright (c) 2024 Matt Zabriskie and contributors // Axios v1.7.7 Copyright (c) 2024 Matt Zabriskie and contributors
'use strict'; 'use strict';
function bind(fn, thisArg) { function bind(fn, thisArg) {
@@ -2699,14 +2699,34 @@ const streamChunk = function* (chunk, chunkSize) {
} }
}; };
const readBytes = async function* (iterable, chunkSize, encode) { const readBytes = async function* (iterable, chunkSize) {
for await (const chunk of iterable) { for await (const chunk of readStream(iterable)) {
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); yield* streamChunk(chunk, chunkSize);
} }
}; };
const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { const readStream = async function* (stream) {
const iterator = readBytes(stream, chunkSize, encode); if (stream[Symbol.asyncIterator]) {
yield* stream;
return;
}
const reader = stream.getReader();
try {
for (;;) {
const {done, value} = await reader.read();
if (done) {
break;
}
yield value;
}
} finally {
await reader.cancel();
}
};
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
const iterator = readBytes(stream, chunkSize);
let bytes = 0; let bytes = 0;
let done; let done;
@@ -2886,7 +2906,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
progressEventReducer(asyncDecorator(onUploadProgress)) progressEventReducer(asyncDecorator(onUploadProgress))
); );
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText); data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
} }
} }
@@ -2929,7 +2949,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => { trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
flush && flush(); flush && flush();
unsubscribe && unsubscribe(); unsubscribe && unsubscribe();
}, encodeText), }),
options options
); );
} }
@@ -3113,7 +3133,7 @@ function dispatchRequest(config) {
}); });
} }
const VERSION = "1.7.6"; const VERSION = "1.7.7";
const validators$1 = {}; const validators$1 = {};
+1 -1
View File
File diff suppressed because one or more lines are too long
+29 -9
View File
@@ -1,4 +1,4 @@
// Axios v1.7.6 Copyright (c) 2024 Matt Zabriskie and contributors // Axios v1.7.7 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);
@@ -2697,14 +2697,34 @@ const streamChunk = function* (chunk, chunkSize) {
} }
}; };
const readBytes = async function* (iterable, chunkSize, encode) { const readBytes = async function* (iterable, chunkSize) {
for await (const chunk of iterable) { for await (const chunk of readStream(iterable)) {
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); yield* streamChunk(chunk, chunkSize);
} }
}; };
const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { const readStream = async function* (stream) {
const iterator = readBytes(stream, chunkSize, encode); if (stream[Symbol.asyncIterator]) {
yield* stream;
return;
}
const reader = stream.getReader();
try {
for (;;) {
const {done, value} = await reader.read();
if (done) {
break;
}
yield value;
}
} finally {
await reader.cancel();
}
};
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
const iterator = readBytes(stream, chunkSize);
let bytes = 0; let bytes = 0;
let done; let done;
@@ -2884,7 +2904,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
progressEventReducer(asyncDecorator(onUploadProgress)) progressEventReducer(asyncDecorator(onUploadProgress))
); );
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText); data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
} }
} }
@@ -2927,7 +2947,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => { trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
flush && flush(); flush && flush();
unsubscribe && unsubscribe(); unsubscribe && unsubscribe();
}, encodeText), }),
options options
); );
} }
@@ -3111,7 +3131,7 @@ function dispatchRequest(config) {
}); });
} }
const VERSION$1 = "1.7.6"; const VERSION$1 = "1.7.7";
const validators$1 = {}; const validators$1 = {};
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+30 -10
View File
@@ -1,4 +1,4 @@
// Axios v1.7.6 Copyright (c) 2024 Matt Zabriskie and contributors // Axios v1.7.7 Copyright (c) 2024 Matt Zabriskie and contributors
'use strict'; 'use strict';
const FormData$1 = require('form-data'); const FormData$1 = require('form-data');
@@ -2071,7 +2071,7 @@ function buildFullPath(baseURL, requestedURL) {
return requestedURL; return requestedURL;
} }
const VERSION = "1.7.6"; const VERSION = "1.7.7";
function parseProtocol(url) { function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -2963,7 +2963,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
if (config.socketPath) { if (config.socketPath) {
options.socketPath = config.socketPath; options.socketPath = config.socketPath;
} else { } else {
options.hostname = parsed.hostname; options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
options.port = parsed.port; options.port = parsed.port;
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
} }
@@ -3730,14 +3730,34 @@ const streamChunk = function* (chunk, chunkSize) {
} }
}; };
const readBytes = async function* (iterable, chunkSize, encode) { const readBytes = async function* (iterable, chunkSize) {
for await (const chunk of iterable) { for await (const chunk of readStream(iterable)) {
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); yield* streamChunk(chunk, chunkSize);
} }
}; };
const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { const readStream = async function* (stream) {
const iterator = readBytes(stream, chunkSize, encode); if (stream[Symbol.asyncIterator]) {
yield* stream;
return;
}
const reader = stream.getReader();
try {
for (;;) {
const {done, value} = await reader.read();
if (done) {
break;
}
yield value;
}
} finally {
await reader.cancel();
}
};
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
const iterator = readBytes(stream, chunkSize);
let bytes = 0; let bytes = 0;
let done; let done;
@@ -3917,7 +3937,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
progressEventReducer(asyncDecorator(onUploadProgress)) progressEventReducer(asyncDecorator(onUploadProgress))
); );
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText); data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
} }
} }
@@ -3960,7 +3980,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => { trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
flush && flush(); flush && flush();
unsubscribe && unsubscribe(); unsubscribe && unsubscribe();
}, encodeText), }),
options options
); );
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
export const VERSION = "1.7.6"; export const VERSION = "1.7.7";
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "axios", "name": "axios",
"version": "1.7.6", "version": "1.7.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "axios", "name": "axios",
"version": "1.7.6", "version": "1.7.7",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"follow-redirects": "^1.15.6", "follow-redirects": "^1.15.6",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "axios", "name": "axios",
"version": "1.7.6", "version": "1.7.7",
"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": {