aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/emicklei/go-restful/curly.go
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com> 2017-11-03 00:20:15 -0700
committerGravatar Miek Gieben <miek@miek.nl> 2017-11-03 07:20:15 +0000
commit1fc0c16968304b169fb7eb52f162ffa4c7cdc55c (patch)
treee242db88ffc7aa291a6344d1ab1d6cd07293cba7 /vendor/github.com/emicklei/go-restful/curly.go
parentaf6086d6535e3309e3bd1e521cb4d51ef113f850 (diff)
downloadcoredns-1fc0c16968304b169fb7eb52f162ffa4c7cdc55c.tar.gz
coredns-1fc0c16968304b169fb7eb52f162ffa4c7cdc55c.tar.zst
coredns-1fc0c16968304b169fb7eb52f162ffa4c7cdc55c.zip
Update vendor libraries except client-go, apimachinery and ugorji/go (#1197)
This fix updates vendor libraries except client-go, apimachinery and ugorji/go, as github.com/ugorji/go/codec is causing compatibilities issues. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'vendor/github.com/emicklei/go-restful/curly.go')
-rw-r--r--vendor/github.com/emicklei/go-restful/curly.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/vendor/github.com/emicklei/go-restful/curly.go b/vendor/github.com/emicklei/go-restful/curly.go
index ce284f747..79f1f5aa2 100644
--- a/vendor/github.com/emicklei/go-restful/curly.go
+++ b/vendor/github.com/emicklei/go-restful/curly.go
@@ -44,16 +44,16 @@ func (c CurlyRouter) SelectRoute(
}
// selectRoutes return a collection of Route from a WebService that matches the path tokens from the request.
-func (c CurlyRouter) selectRoutes(ws *WebService, requestTokens []string) []Route {
- candidates := &sortableCurlyRoutes{[]*curlyRoute{}}
+func (c CurlyRouter) selectRoutes(ws *WebService, requestTokens []string) sortableCurlyRoutes {
+ candidates := sortableCurlyRoutes{}
for _, each := range ws.routes {
matches, paramCount, staticCount := c.matchesRouteByPathTokens(each.pathParts, requestTokens)
if matches {
- candidates.add(&curlyRoute{each, paramCount, staticCount}) // TODO make sure Routes() return pointers?
+ candidates.add(curlyRoute{each, paramCount, staticCount}) // TODO make sure Routes() return pointers?
}
}
sort.Sort(sort.Reverse(candidates))
- return candidates.routes()
+ return candidates
}
// matchesRouteByPathTokens computes whether it matches, howmany parameters do match and what the number of static path elements are.
@@ -108,11 +108,13 @@ func (c CurlyRouter) regularMatchesPathToken(routeToken string, colon int, reque
return (matched && err == nil), false
}
+var jsr311Router = RouterJSR311{}
+
// detectRoute selectes from a list of Route the first match by inspecting both the Accept and Content-Type
// headers of the Request. See also RouterJSR311 in jsr311.go
-func (c CurlyRouter) detectRoute(candidateRoutes []Route, httpRequest *http.Request) (*Route, error) {
+func (c CurlyRouter) detectRoute(candidateRoutes sortableCurlyRoutes, httpRequest *http.Request) (*Route, error) {
// tracing is done inside detectRoute
- return RouterJSR311{}.detectRoute(candidateRoutes, httpRequest)
+ return jsr311Router.detectRoute(candidateRoutes.routes(), httpRequest)
}
// detectWebService returns the best matching webService given the list of path tokens.