Merge pull request #274 from yh4922/api_cors_fix

prev pr patch
pull/275/head
yoko 2 years ago committed by GitHub
commit 606303d98f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -253,7 +253,8 @@ func (h *HttpApiServer) notFoundHandler(w http.ResponseWriter, req *http.Request
func feedback(v interface{}, w http.ResponseWriter) {
resp, _ := json.Marshal(v)
w.Header().Add("Server", base.LalHttpApiServer)
w.Header().Set("Access-Control-Allow-Origin", "*") // 跨域
w.Header().Set("Access-Control-Allow-Origin", "*") // 跨域
w.Header().Set("Access-Control-Allow-Headers", "Content-Type") // 跨域补充
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write(resp)
}

Loading…
Cancel
Save