bugfix: 通过修改配置文件使得跨域白名单正常生效 (#1296)

* bugfix: 通过修改配置文件使得跨域白名单正常生效

Co-authored-by: 奇淼(piexlmax <qimiaojiangjizhao@gmail.com>
This commit is contained in:
andywu1998
2022-11-30 16:52:00 +08:00
committed by GitHub
co-authored by 奇淼(piexlmax
parent e67354f34c
commit b6f3038a73
3 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ func CorsByRules() gin.HandlerFunc {
c.AbortWithStatus(http.StatusForbidden)
} else {
// 非严格白名单模式,无论是否通过检查均放行所有 OPTIONS 方法
if c.Request.Method == "OPTIONS" {
if c.Request.Method == http.MethodOptions {
c.AbortWithStatus(http.StatusNoContent)
}
}