From cf751c4c2831b589f417a19d181ad84c432d223e Mon Sep 17 00:00:00 2001 From: sakuraikiyoshi Date: Wed, 7 Jan 2026 00:23:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0CORS=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=94=AF=E6=8C=81=E6=9B=B4=E5=A4=9AHTTP=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- background/apps.json | 4 +--- background/main.go | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/background/apps.json b/background/apps.json index 41b42e6..fe51488 100644 --- a/background/apps.json +++ b/background/apps.json @@ -1,3 +1 @@ -[ - -] +[] diff --git a/background/main.go b/background/main.go index 3af2a82..6e67c8f 100644 --- a/background/main.go +++ b/background/main.go @@ -113,11 +113,11 @@ func main() { // 添加CORS中间件 r.Use(func(c *gin.Context) { c.Writer.Header().Set("Access-Control-Allow-Origin", "*") - c.Writer.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS") + c.Writer.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS") c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization") if c.Request.Method == "OPTIONS" { - c.AbortWithStatus(204) + c.AbortWithStatus(200) return }