Use Set instead of Add for CORS header

pull/1/head
maru 2023-12-29 14:33:11 -05:00
parent 1dee0cbc3a
commit 955359c3b1
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D
1 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,7 @@ type Server struct {
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if s.Debug { if s.Debug {
w.Header().Add("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Origin", "*")
if r.Method == "OPTIONS" { if r.Method == "OPTIONS" {
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)