Remove HEAD support, change sql query name

This commit is contained in:
ppeb
2024-09-16 01:17:31 -05:00
parent 64e007631f
commit e12944ccab
6 changed files with 11 additions and 25 deletions

View File

@@ -16,12 +16,9 @@ func HandleBan(w http.ResponseWriter, r *http.Request) {
var err string
var statusCode int
switch r.Method {
case http.MethodHead:
statusCode = http.StatusOK
case http.MethodPost:
if r.Method == http.MethodPost {
user, success, err, statusCode = handleBanImpl(w, r)
default:
} else {
err = "Incorrect request. POST or HEAD only."
statusCode = http.StatusBadRequest
}

View File

@@ -14,13 +14,10 @@ func HandleClear(w http.ResponseWriter, r *http.Request) {
var err string
var statusCode int
switch r.Method {
case http.MethodHead:
statusCode = http.StatusOK
case http.MethodPost:
if r.Method == http.MethodPost {
user, success, err, statusCode = handleClearImpl(w, r)
default:
err = "Incorrect request. POST or HEAD only."
} else {
err = "Incorrect request. POST only."
statusCode = http.StatusBadRequest
}

View File

@@ -15,12 +15,9 @@ func HandleKick(w http.ResponseWriter, r *http.Request) {
var err string
var statusCode int
switch r.Method {
case http.MethodHead:
statusCode = http.StatusOK
case http.MethodPost:
if r.Method == http.MethodPost {
user, success, err, statusCode = handleKickImpl(w, r)
default:
} else {
err = "Incorrect request. POST or HEAD only."
statusCode = http.StatusBadRequest
}

View File

@@ -15,8 +15,6 @@ func HandleMotd(w http.ResponseWriter, r *http.Request) {
var statusCode int
switch r.Method {
case http.MethodHead:
statusCode = http.StatusOK
case http.MethodGet:
_motd, motdErr := gpcm.GetMessageOfTheDay()
if motdErr != nil {

View File

@@ -14,12 +14,9 @@ func HandleUnban(w http.ResponseWriter, r *http.Request) {
var err string
var statusCode int
switch r.Method {
case http.MethodHead:
statusCode = http.StatusOK
case http.MethodPost:
if r.Method == http.MethodPost {
user, success, err, statusCode = handleUnbanImpl(w, r)
default:
} else {
err = "Incorrect request. POST or HEAD only."
statusCode = http.StatusBadRequest
}