diff --git a/src/utils/request.js b/src/utils/request.js index bfb42b9..273bacd 100644 --- a/src/utils/request.js +++ b/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, }); }