Remove get prefix from certain function names

pull/4/head
maru 8 months ago
parent 768900d885
commit 849bc601f0
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D

@ -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
}

@ -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

Loading…
Cancel
Save