diff --git a/main.go b/main.go index 577ac75..0410be5 100644 --- a/main.go +++ b/main.go @@ -39,8 +39,9 @@ func (c Config) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } + cors(w) if r.Method == http.MethodOptions { - cors(w) + w.WriteHeader(http.StatusOK) return } @@ -77,7 +78,6 @@ func cors(w http.ResponseWriter) { 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") - w.WriteHeader(http.StatusOK) } func (c Config) key(r *http.Request) string {