From 4f6499c04fcb202ab100ae2fd4929084788b3bb6 Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Mon, 14 Apr 2025 15:03:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=B7=E6=B1=82=E5=A4=B4?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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, }); }