From 7e3ba249dfe432cf3649f227e2e012c4358bad2e Mon Sep 17 00:00:00 2001 From: maru Date: Wed, 24 Apr 2024 20:23:20 -0400 Subject: [PATCH] Move httpError to common.go --- api/common.go | 6 ++++++ api/endpoints.go | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/common.go b/api/common.go index e3c20f5..25fe65a 100644 --- a/api/common.go +++ b/api/common.go @@ -3,6 +3,7 @@ package api import ( "encoding/base64" "fmt" + "log" "net/http" "github.com/pagefaultgames/pokerogue-server/api/account" @@ -81,3 +82,8 @@ func getUUIDFromRequest(r *http.Request) ([]byte, error) { return uuid, nil } + +func httpError(w http.ResponseWriter, r *http.Request, err error, code int) { + log.Printf("%s: %s\n", r.URL.Path, err) + http.Error(w, err.Error(), code) +} \ No newline at end of file diff --git a/api/endpoints.go b/api/endpoints.go index 17fa16f..45f4537 100644 --- a/api/endpoints.go +++ b/api/endpoints.go @@ -4,7 +4,6 @@ import ( "encoding/base64" "encoding/json" "fmt" - "log" "net/http" "strconv" @@ -21,11 +20,6 @@ import ( Handlers should not return serialized JSON, instead return the struct itself. */ -func httpError(w http.ResponseWriter, r *http.Request, err error, code int) { - log.Printf("%s: %s\n", r.URL.Path, err) - http.Error(w, err.Error(), code) -} - // account func handleAccountInfo(w http.ResponseWriter, r *http.Request) {