yangyin
2024-11-08 c2c7d3c66be938892edaa77d96d8af7f98a66c6d
src/utils/request.ts
@@ -132,7 +132,9 @@
   return axios.create({
      baseURL: MAIN_URL,
      timeout: 1200000,
      headers: { 'Content-Type': 'application/json;charset=utf-8 ' },
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
      ...option,
   });
};
@@ -147,7 +149,6 @@
   responseType: 'stream',
});
const decoder = new TextDecoder();
const encoder = new TextEncoder();
const readStream = async (stream: ReadableStream, cb: (value) => void): Promise<any> => {
   const reader = stream.getReader();
   let lastValue = '';
@@ -161,12 +162,11 @@
         // const txt = decoder.decode(Uint8Array.from([...lastValue, ...value]));
         const txt = decoder.decode(value);
         const txtArr = txt.split('\n');
         txtArr[0] =lastValue+ txtArr[0]
         txtArr[0] = lastValue + txtArr[0];
         txtArr.forEach((value, index, array) => {
            // 一般不会出现连续换行,只可能最后一个是换行
            if (index === array.length - 1) {
               lastValue =value;
               lastValue = value;
            } else {
               const decodeValue = decodeURIComponent(value);
               fullValue += decodeValue;