mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
chore(release): v1.7.1 (#6411)
Co-authored-by: DigitalBrainJS <12586868+DigitalBrainJS@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
733f15fe5b
commit
67d1373131
Vendored
+15
-11
@@ -1,4 +1,4 @@
|
||||
// Axios v1.7.0 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||
// Axios v1.7.1 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||
'use strict';
|
||||
|
||||
const FormData$1 = require('form-data');
|
||||
@@ -2035,7 +2035,7 @@ function buildFullPath(baseURL, requestedURL) {
|
||||
return requestedURL;
|
||||
}
|
||||
|
||||
const VERSION = "1.7.0";
|
||||
const VERSION = "1.7.1";
|
||||
|
||||
function parseProtocol(url) {
|
||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||
@@ -3702,16 +3702,14 @@ const streamChunk = function* (chunk, chunkSize) {
|
||||
}
|
||||
};
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
const readBytes = async function* (iterable, chunkSize) {
|
||||
const readBytes = async function* (iterable, chunkSize, encode) {
|
||||
for await (const chunk of iterable) {
|
||||
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encoder.encode(String(chunk))), chunkSize);
|
||||
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
|
||||
}
|
||||
};
|
||||
|
||||
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
||||
const iterator = readBytes(stream, chunkSize);
|
||||
const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
|
||||
const iterator = readBytes(stream, chunkSize, encode);
|
||||
|
||||
let bytes = 0;
|
||||
|
||||
@@ -3752,6 +3750,12 @@ const fetchProgressDecorator = (total, fn) => {
|
||||
const isFetchSupported = typeof fetch !== 'undefined';
|
||||
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream !== 'undefined';
|
||||
|
||||
// used only inside the fetch adapter
|
||||
const encodeText = isFetchSupported && (typeof TextEncoder !== 'undefined' ?
|
||||
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
||||
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
||||
);
|
||||
|
||||
const supportsRequestStream = isReadableStreamSupported && (() => {
|
||||
let duplexAccessed = false;
|
||||
|
||||
@@ -3812,7 +3816,7 @@ const getBodyLength = async (body) => {
|
||||
}
|
||||
|
||||
if(utils$1.isString(body)) {
|
||||
return (await new TextEncoder().encode(body)).byteLength;
|
||||
return (await encodeText(body)).byteLength;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3876,7 +3880,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
||||
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
|
||||
requestContentLength,
|
||||
progressEventReducer(onUploadProgress)
|
||||
));
|
||||
), null, encodeText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3911,7 +3915,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
||||
trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(
|
||||
responseContentLength,
|
||||
progressEventReducer(onDownloadProgress, true)
|
||||
), isStreamResponse && onFinish),
|
||||
), isStreamResponse && onFinish, encodeText),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user