From 7ecd479b3e7d5939a513ed74b3d6ed37891496fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 13 May 2024 21:22:20 +0800 Subject: [PATCH] refactor: webapi http --- src/common/utils/request.ts | 7 ++++++- src/core | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/utils/request.ts b/src/common/utils/request.ts index 619a3c5d..17e6c6dd 100644 --- a/src/common/utils/request.ts +++ b/src/common/utils/request.ts @@ -61,7 +61,12 @@ export class RequestUtil { requestInit.headers = new Headers(headers); } try { - const response = await fetch(url, { ...requestInit, body: data }); + let response; + if (method.toUpperCase() === 'POST') { + response = await fetch(url, { ...requestInit, body: data }); + } else { + response = await fetch(url, { ...requestInit }); + } if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } diff --git a/src/core b/src/core index d06dd4d6..f88118be 160000 --- a/src/core +++ b/src/core @@ -1 +1 @@ -Subproject commit d06dd4d66ca4d50c70ce066cd872edb939138d34 +Subproject commit f88118be512b1ed1537b2aad1f183c04858e1d70