跨域响应头补充

This commit is contained in:
TsMask
2023-09-08 21:09:18 +08:00
parent 6fdc40eb5d
commit d870920485
2 changed files with 8 additions and 5 deletions

View File

@@ -48,10 +48,12 @@ func Cors(next http.Handler) http.Handler {
// 允许请求头
allowHeaders := []string{
"Accesstoken",
"Content-Type",
"operationtype",
}
w.Header().Set("Access-Control-Allow-Headers", strings.Join(allowHeaders, ","))
w.WriteHeader(500)
w.WriteHeader(204)
return
}