diff --git a/api/common.go b/api/common.go index 25fe65a..6845fed 100644 --- a/api/common.go +++ b/api/common.go @@ -38,7 +38,7 @@ func Init(mux *http.ServeMux) { mux.HandleFunc("/daily/rankingpagecount", handleDailyRankingPageCount) } -func getTokenFromRequest(r *http.Request) ([]byte, error) { +func tokenFromRequest(r *http.Request) ([]byte, error) { if r.Header.Get("Authorization") == "" { return nil, fmt.Errorf("missing token") } @@ -55,8 +55,8 @@ func getTokenFromRequest(r *http.Request) ([]byte, error) { return token, nil } -func getUsernameFromRequest(r *http.Request) (string, error) { - token, err := getTokenFromRequest(r) +func usernameFromRequest(r *http.Request) (string, error) { + token, err := tokenFromRequest(r) if err != nil { return "", err } @@ -69,8 +69,8 @@ func getUsernameFromRequest(r *http.Request) (string, error) { return username, nil } -func getUUIDFromRequest(r *http.Request) ([]byte, error) { - token, err := getTokenFromRequest(r) +func uuidFromRequest(r *http.Request) ([]byte, error) { + token, err := tokenFromRequest(r) if err != nil { return nil, err } diff --git a/api/endpoints.go b/api/endpoints.go index 45f4537..14569b1 100644 --- a/api/endpoints.go +++ b/api/endpoints.go @@ -23,13 +23,13 @@ import ( // account func handleAccountInfo(w http.ResponseWriter, r *http.Request) { - username, err := getUsernameFromRequest(r) + username, err := usernameFromRequest(r) if err != nil { httpError(w, r, err, http.StatusBadRequest) return } - uuid, err := getUUIDFromRequest(r) // lazy + uuid, err := uuidFromRequest(r) // lazy if err != nil { httpError(w, r, err, http.StatusBadRequest) return @@ -128,7 +128,7 @@ func handleGameClassicSessionCount(w http.ResponseWriter, r *http.Request) { } func handleSaveData(w http.ResponseWriter, r *http.Request) { - uuid, err := getUUIDFromRequest(r) + uuid, err := uuidFromRequest(r) if err != nil { httpError(w, r, err, http.StatusBadRequest) return @@ -178,7 +178,7 @@ func handleSaveData(w http.ResponseWriter, r *http.Request) { } var token []byte - token, err = getTokenFromRequest(r) + token, err = tokenFromRequest(r) if err != nil { httpError(w, r, err, http.StatusBadRequest) return