From 99596a4149522e0c74ad43111ebbcfd0b6cf5d2a Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Fri, 11 Dec 2020 16:12:33 +0800 Subject: [PATCH] fix issue #266 (#275) * optimize dockerfile * fix issue #266 --- rest/router/patrouter.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rest/router/patrouter.go b/rest/router/patrouter.go index cee331d5..b6fa299b 100644 --- a/rest/router/patrouter.go +++ b/rest/router/patrouter.go @@ -64,7 +64,7 @@ func (pr *patRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } - allow, ok := pr.methodNotAllowed(r.Method, reqPath) + allows, ok := pr.methodsAllowed(r.Method, reqPath) if !ok { pr.handleNotFound(w, r) return @@ -73,7 +73,7 @@ func (pr *patRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) { if pr.notAllowed != nil { pr.notAllowed.ServeHTTP(w, r) } else { - w.Header().Set(allowHeader, allow) + w.Header().Set(allowHeader, allows) w.WriteHeader(http.StatusMethodNotAllowed) } } @@ -94,7 +94,7 @@ func (pr *patRouter) handleNotFound(w http.ResponseWriter, r *http.Request) { } } -func (pr *patRouter) methodNotAllowed(method, path string) (string, bool) { +func (pr *patRouter) methodsAllowed(method, path string) (string, bool) { var allows []string for treeMethod, tree := range pr.trees {