Add cors headers (#85)

* disable EnableAuthOnOptions

* Setup basic cors headers

* feature: user cors lib
This commit is contained in:
Maycon Santos
2021-08-16 11:29:57 +02:00
committed by GitHub
parent 877ad97a96
commit 38e3c9c062
6 changed files with 32 additions and 13 deletions

View File

@@ -39,7 +39,6 @@ func (h *Peers) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/", http.StatusInternalServerError)
return
}
w.WriteHeader(200)
w.Header().Set("Content-Type", "application/json")
@@ -60,7 +59,6 @@ func (h *Peers) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/", http.StatusInternalServerError)
return
}
case http.MethodOptions:
default:
http.Error(w, "", http.StatusNotFound)
}

View File

@@ -38,7 +38,6 @@ func (h *SetupKeys) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/", http.StatusInternalServerError)
return
}
w.WriteHeader(200)
w.Header().Set("Content-Type", "application/json")
@@ -58,7 +57,6 @@ func (h *SetupKeys) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/", http.StatusInternalServerError)
return
}
case http.MethodOptions:
default:
http.Error(w, "", http.StatusNotFound)
}