开启API跨域

pull/273/head
sanenchen 2 years ago
parent 3510e71516
commit e099ccc05b

@ -253,6 +253,7 @@ 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("Content-Type", "application/json")
_, _ = w.Write(resp)
}

Loading…
Cancel
Save