mirror of
https://github.com/openfaas/faas.git
synced 2025-06-21 14:23:25 +00:00
Use http package consts for http methods
This commit replaces occurences of http method strings with the corresponding consts from the http package. *Note* UPDATE is not strictly speaking a valid method and as such isn't part of the http package (should be a PUT or PATCH?) Signed-off-by: John McCabe <john@johnmccabe.net>
This commit is contained in:
@ -277,7 +277,7 @@ func removeLockFile() error {
|
||||
func makeHealthHandler() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case "GET":
|
||||
case http.MethodGet:
|
||||
if lockFilePresent() == false {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
@ -298,11 +298,11 @@ func makeRequestHandler(config *WatchdogConfig) func(http.ResponseWriter, *http.
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case
|
||||
"POST",
|
||||
"PUT",
|
||||
"DELETE",
|
||||
http.MethodPost,
|
||||
http.MethodPut,
|
||||
http.MethodDelete,
|
||||
"UPDATE",
|
||||
"GET":
|
||||
http.MethodGet:
|
||||
pipeRequest(config, w, r, r.Method)
|
||||
break
|
||||
default:
|
||||
|
Reference in New Issue
Block a user