|
|
|
@@ -39,8 +39,15 @@ func (c Config) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if endpoint.Redir {
|
|
|
|
|
http.Redirect(w, r, r.URL.String(), http.StatusSeeOther)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cors(w)
|
|
|
|
|
if r.Method == http.MethodOptions {
|
|
|
|
|
w.Header().Set("Content-Length", "0")
|
|
|
|
|
w.Header().Set("Content-Type", "text/plain")
|
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@@ -75,8 +82,6 @@ func (c Config) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
func cors(w http.ResponseWriter) {
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Headers", "X-Auth-Token, content-type, Content-Type")
|
|
|
|
|
w.Header().Set("Content-Length", "0")
|
|
|
|
|
w.Header().Set("Content-Type", "text/plain")
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS, TRACE, PATCH, HEAD, DELETE")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|