summaryrefslogtreecommitdiff
path: root/vendor/github.com/gorilla/mux/middleware.go
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2020-02-12 09:17:29 +0000
committerDaniel J Walsh <dwalsh@redhat.com>2020-02-12 05:20:50 -0500
commitb916263d013361e2ac3020ade598a65d46a77465 (patch)
tree5ed8e16b2d77c7a7b1cbfe907ec50851d6c7214f /vendor/github.com/gorilla/mux/middleware.go
parentd0452ae6f3e3bd664ad45ef13ed5da1a8c09006b (diff)
downloadpodman-b916263d013361e2ac3020ade598a65d46a77465.tar.gz
podman-b916263d013361e2ac3020ade598a65d46a77465.tar.bz2
podman-b916263d013361e2ac3020ade598a65d46a77465.zip
build(deps): bump github.com/gorilla/mux from 1.7.3 to 1.7.4
Bumps [github.com/gorilla/mux](https://github.com/gorilla/mux) from 1.7.3 to 1.7.4. - [Release notes](https://github.com/gorilla/mux/releases) - [Commits](https://github.com/gorilla/mux/compare/v1.7.3...v1.7.4) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
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
}