From 955359c3b1a1495d4aa128458c50c5a7891f86e9 Mon Sep 17 00:00:00 2001 From: maru Date: Fri, 29 Dec 2023 14:33:11 -0500 Subject: [PATCH] Use Set instead of Add for CORS header --- api/generic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/generic.go b/api/generic.go index dbb2668..3c98c62 100644 --- a/api/generic.go +++ b/api/generic.go @@ -8,8 +8,8 @@ type Server struct { func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { if s.Debug { - w.Header().Add("Access-Control-Allow-Origin", "*") - + w.Header().Set("Access-Control-Allow-Origin", "*") + if r.Method == "OPTIONS" { w.WriteHeader(http.StatusOK) return