diff options
author | Tomofumi Hayashi <tohayash@redhat.com> | 2019-04-27 20:38:39 +0900 |
---|---|---|
committer | Tomofumi Hayashi <tohayash@redhat.com> | 2019-04-27 20:40:37 +0900 |
commit | 4d11ca17d0f73f5bd783f45900118295fdfed46b (patch) | |
tree | cce8575b02ac850d2b30ec12a5c4083c48e85c6c /src/dma/vendor/github.com/labstack/echo/router.go | |
parent | 07e4a96e4996f3d39b92dd601b3ed0d23bfbaa0c (diff) |
barometer: update DMA's vendoring packages
Change-Id: I0578b094f1ecdaed20c906be2ba29d51b8089d7c
Signed-off-by: Tomofumi Hayashi <tohayash@redhat.com>
Diffstat (limited to 'src/dma/vendor/github.com/labstack/echo/router.go')
-rw-r--r-- | src/dma/vendor/github.com/labstack/echo/router.go | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/dma/vendor/github.com/labstack/echo/router.go b/src/dma/vendor/github.com/labstack/echo/router.go index ff53da87..73f0b68b 100644 --- a/src/dma/vendor/github.com/labstack/echo/router.go +++ b/src/dma/vendor/github.com/labstack/echo/router.go @@ -1,5 +1,7 @@ package echo +import "net/http" + type ( // Router is the registry of all registered routes for an `Echo` instance for // request matching and URL path parameter parsing. @@ -79,7 +81,7 @@ func (r *Router) Add(method, path string, h HandlerFunc) { r.insert(method, path[:i], h, pkind, ppath, pnames) return } - r.insert(method, path[:i], nil, pkind, ppath, pnames) + r.insert(method, path[:i], nil, pkind, "", nil) } else if path[i] == '*' { r.insert(method, path[:i], nil, skind, "", nil) pnames = append(pnames, "*") @@ -226,50 +228,50 @@ func (n *node) findChildByKind(t kind) *node { func (n *node) addHandler(method string, h HandlerFunc) { switch method { - case CONNECT: + case http.MethodConnect: n.methodHandler.connect = h - case DELETE: + case http.MethodDelete: n.methodHandler.delete = h - case GET: + case http.MethodGet: n.methodHandler.get = h - case HEAD: + case http.MethodHead: n.methodHandler.head = h - case OPTIONS: + case http.MethodOptions: n.methodHandler.options = h - case PATCH: + case http.MethodPatch: n.methodHandler.patch = h - case POST: + case http.MethodPost: n.methodHandler.post = h case PROPFIND: n.methodHandler.propfind = h - case PUT: + case http.MethodPut: n.methodHandler.put = h - case TRACE: + case http.MethodTrace: n.methodHandler.trace = h } } func (n *node) findHandler(method string) HandlerFunc { switch method { - case CONNECT: + case http.MethodConnect: return n.methodHandler.connect - case DELETE: + case http.MethodDelete: return n.methodHandler.delete - case GET: + case http.MethodGet: return n.methodHandler.get - case HEAD: + case http.MethodHead: return n.methodHandler.head - case OPTIONS: + case http.MethodOptions: return n.methodHandler.options - case PATCH: + case http.MethodPatch: return n.methodHandler.patch - case POST: + case http.MethodPost: return n.methodHandler.post case PROPFIND: return n.methodHandler.propfind - case PUT: + case http.MethodPut: return n.methodHandler.put - case TRACE: + case http.MethodTrace: return n.methodHandler.trace default: return nil @@ -311,7 +313,7 @@ func (r *Router) Find(method, path string, c Context) { // Search order static > param > any for { if search == "" { - goto End + break } pl := 0 // Prefix length @@ -346,7 +348,7 @@ func (r *Router) Find(method, path string, c Context) { } if search == "" { - goto End + break } // Static node @@ -403,10 +405,9 @@ func (r *Router) Find(method, path string, c Context) { return } pvalues[len(cn.pnames)-1] = search - goto End + break } -End: ctx.handler = cn.findHandler(method) ctx.path = cn.ppath ctx.pnames = cn.pnames |