From 8a32efeaa3985df9cdc7176ba6888e02146ae32e Mon Sep 17 00:00:00 2001 From: maru Date: Fri, 10 May 2024 13:40:00 -0400 Subject: [PATCH] Clean up rogueserver.go --- rogueserver.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rogueserver.go b/rogueserver.go index 5659cae..42f2d7d 100644 --- a/rogueserver.go +++ b/rogueserver.go @@ -101,11 +101,11 @@ func createListener(proto, addr string) (net.Listener, error) { return listener, nil } -func debugHandler(router *http.ServeMux) http.Handler { +func prodHandler(router *http.ServeMux) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Access-Control-Allow-Headers", "*") - w.Header().Set("Access-Control-Allow-Methods", "*") - w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type") + w.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST") + w.Header().Set("Access-Control-Allow-Origin", "https://pokerogue.net") if r.Method == "OPTIONS" { w.WriteHeader(http.StatusOK) @@ -116,12 +116,11 @@ func debugHandler(router *http.ServeMux) http.Handler { }) } - -func prodHandler(router *http.ServeMux) http.Handler { +func debugHandler(router *http.ServeMux) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type") - w.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST") - w.Header().Set("Access-Control-Allow-Origin", "https://pokerogue.net") + w.Header().Set("Access-Control-Allow-Headers", "*") + w.Header().Set("Access-Control-Allow-Methods", "*") + w.Header().Set("Access-Control-Allow-Origin", "*") if r.Method == "OPTIONS" { w.WriteHeader(http.StatusOK) @@ -131,3 +130,4 @@ func prodHandler(router *http.ServeMux) http.Handler { router.ServeHTTP(w, r) }) } +