feat: 跨域中间件

This commit is contained in:
TsMask
2023-09-07 21:04:29 +08:00
parent 7b243bf0dd
commit 4f3878e4a2
4 changed files with 68 additions and 11 deletions

View File

@@ -37,6 +37,7 @@ func LoggerTrace(next http.Handler) http.Handler {
})
}
// 已禁用
func OptionProcess(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method == "OPTIONS" {
@@ -48,6 +49,7 @@ func OptionProcess(next http.Handler) http.Handler {
})
}
// 已禁用
func CheckPermission(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
token := r.Header.Get("AccessToken")