Browse Source

修改请求头位置

zq-newmaster
zq 1 month ago
parent
commit
4f6499c04f
  1. 9
      src/utils/request.js

9
src/utils/request.js

@ -5,6 +5,9 @@ import axios from "axios";
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // 从环境变量中读取 API 基础地址
timeout: 10000, // 请求超时时间
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
});
// 请求拦截器
@ -74,9 +77,6 @@ const request = (method, url, data = {}, config = {}) => {
method: "get",
url,
params: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
...config,
});
} else {
@ -85,9 +85,6 @@ const request = (method, url, data = {}, config = {}) => {
method: lowerCaseMethod,
url,
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
...config,
});
}

Loading…
Cancel
Save