From 944ad1dae2000a99bba8266349f3a1a0b4c8dff2 Mon Sep 17 00:00:00 2001 From: Sawood Alam Date: Wed, 29 Apr 2020 13:07:29 -0400 Subject: [PATCH] Rename setAllowedHeaders to setAllowHeader to better reflect the purpose --- http/handler.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/http/handler.go b/http/handler.go index 349d4d8..9afd4a4 100644 --- a/http/handler.go +++ b/http/handler.go @@ -107,7 +107,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // The CORS library handles all other requests. // Tell the user the allowed methods, and return. - setAllowedHeaders(w, h.cfg.AllowGet) + setAllowHeader(w, h.cfg.AllowGet) w.WriteHeader(http.StatusNoContent) return case http.MethodPost: @@ -117,7 +117,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } fallthrough default: - setAllowedHeaders(w, h.cfg.AllowGet) + setAllowHeader(w, h.cfg.AllowGet) http.Error(w, "405 - Method Not Allowed", http.StatusMethodNotAllowed) log.Warnf("The IPFS API does not support %s requests.", r.Method) return @@ -192,7 +192,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.root.Call(req, re, h.env) } -func setAllowedHeaders(w http.ResponseWriter, allowGet bool) { +func setAllowHeader(w http.ResponseWriter, allowGet bool) { allowedMethods := []string{http.MethodOptions, http.MethodPost} if allowGet { allowedMethods = append(allowedMethods, http.MethodHead, http.MethodGet) -- GitLab