summaryrefslogtreecommitdiff
path: root/vendor/github.com/gorilla/mux/middleware.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-02-13 02:34:57 +0100
committerGitHub <noreply@github.com>2020-02-13 02:34:57 +0100
commitc16e12f6c51e03dd950cbe4b9ac3bb92519fef71 (patch)
treeb3aa140ed2aa14aaf44bcd665ebc741955f2420d /vendor/github.com/gorilla/mux/middleware.go
parent502a87a1b16216b4ba5044817a648d3c865d63b4 (diff)
parentb916263d013361e2ac3020ade598a65d46a77465 (diff)
downloadpodman-c16e12f6c51e03dd950cbe4b9ac3bb92519fef71.tar.gz
podman-c16e12f6c51e03dd950cbe4b9ac3bb92519fef71.tar.bz2
podman-c16e12f6c51e03dd950cbe4b9ac3bb92519fef71.zip
Merge pull request #5181 from containers/dependabot/go_modules/github.com/gorilla/mux-1.7.4
build(deps): bump github.com/gorilla/mux from 1.7.3 to 1.7.4
Diffstat (limited to 'vendor/github.com/gorilla/mux/middleware.go')
-rw-r--r--vendor/github.com/gorilla/mux/middleware.go25
1 files changed, 10 insertions, 15 deletions
diff --git a/vendor/github.com/gorilla/mux/middleware.go b/vendor/github.com/gorilla/mux/middleware.go
index cf2b26dc0..cb51c565e 100644
--- a/vendor/github.com/gorilla/mux/middleware.go
+++ b/vendor/github.com/gorilla/mux/middleware.go
@@ -58,22 +58,17 @@ func CORSMethodMiddleware(r *Router) MiddlewareFunc {
func getAllMethodsForRoute(r *Router, req *http.Request) ([]string, error) {
var allMethods []string
- err := r.Walk(func(route *Route, _ *Router, _ []*Route) error {
- for _, m := range route.matchers {
- if _, ok := m.(*routeRegexp); ok {
- if m.Match(req, &RouteMatch{}) {
- methods, err := route.GetMethods()
- if err != nil {
- return err
- }
-
- allMethods = append(allMethods, methods...)
- }
- break
+ for _, route := range r.routes {
+ var match RouteMatch
+ if route.Match(req, &match) || match.MatchErr == ErrMethodMismatch {
+ methods, err := route.GetMethods()
+ if err != nil {
+ return nil, err
}
+
+ allMethods = append(allMethods, methods...)
}
- return nil
- })
+ }
- return allMethods, err
+ return allMethods, nil
}