From 6935cb24d1058801b469e2aee1ccc98b10ad88a3 Mon Sep 17 00:00:00 2001 From: "liu.shiyi" Date: Thu, 3 Aug 2023 09:58:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:http=E6=95=B0=E6=8D=AE=E9=9B=86=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E4=BD=93=E8=84=9A=E6=9C=AC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages/js/utils/httpParamsFormatting.js | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/data-room-ui/packages/js/utils/httpParamsFormatting.js b/data-room-ui/packages/js/utils/httpParamsFormatting.js index 67256df1..b81d210d 100644 --- a/data-room-ui/packages/js/utils/httpParamsFormatting.js +++ b/data-room-ui/packages/js/utils/httpParamsFormatting.js @@ -7,7 +7,7 @@ export default function axiosFormatting (customConfig) { const httpConfig = { timeout: 1000 * 30, baseURL: '', - headers: newCustomConfig.headers + headers: { 'Content-Type': 'application/json', ...newCustomConfig.headers } } // let loadingInstance = null // 加载全局的loading const instance = axios.create(httpConfig) @@ -47,7 +47,7 @@ export default function axiosFormatting (customConfig) { } }) const body = newCustomConfig?.body.replace(/: ,/g, ':undefined,').replace(/, }/g, ',undefined}') - console.log('body', body) + /** 发送请求 **/ return new Promise((resolve, reject) => { instance({ method: newCustomConfig.method, @@ -61,22 +61,6 @@ export default function axiosFormatting (customConfig) { }) }) } -// function stringToObject (inputString) { -// const lines = inputString.split('\n') -// const result = {} -// -// lines.forEach(line => { -// // Use regular expressions to extract property name and value -// const propertyMatch = line.match(/^(.*?)=(.*)$/) -// if (propertyMatch) { -// const propertyName = propertyMatch[1].trim() -// const propertyValue = propertyMatch[2].trim().replace(/'/g, '') // Remove single quotes from the value -// result[propertyName] = propertyValue -// } -// }) -// -// return { body: result } -// } // 动态替换url后面参数的值 function replaceUrlParam (url, paramName, paramValue) { const regex = new RegExp(`([?&])${paramName}=.*?(&|$)`, 'i')