util/srv/misc.go
func (s *Server) RequireHTTPMethods(logger log.Logger,
	handler HandlerFunc, methods ...string) HandlerFunc {
	l := logger.Add("method", "RequireHTTPMethods")
	return func(w http.ResponseWriter, r *http.Request, ctx *Context) {
		for _, v := range methods {
			if v == r.Method {
				handler(w, r, ctx)
				return
			}
		}

		l.Add("sender", r.RemoteAddr).Warn("not allowed HTTP method")
		s.RespondError(logger, w, ErrMethodNotAllowed)
	}
}
func (s *Server) RequireHTTPMethods(logger log.Logger,
	handler HandlerFunc, methods ...string) HandlerFunc {
	l := logger.Add("method", "RequireHTTPMethods")
	return func(w http.ResponseWriter, r *http.Request, ctx *Context) {
		for _, v := range methods {
			if v == r.Method {
				handler(w, r, ctx)
				return
			}
		}

		l.Add("sender", r.RemoteAddr).Warn("not allowed HTTP method")
		s.RespondError(logger, w, ErrMethodNotAllowed)
	}
}
func ( s * Server ) RequireHTTPMethods ( logger log . Logger , handler HandlerFunc , methods ... string ) HandlerFunc { l := logger . Add ( " " , " " ) return func ( w http . ResponseWriter , r * http . Request , ctx * Context ) { for _ , v := range methods { if v == r . Method { handler ( w , r , ctx ) return } } l . Add ( " " , r . RemoteAddr ) . Warn ( " " ) s . RespondError ( logger , w , ErrMethodNotAllowed ) } }
// RequireHTTPMethods wraps a given handler function inside an HTTP method
// validating handler.
RequireHTTPMethods wraps a given handler function inside an HTTP method validating handler .