diff options
Diffstat (limited to 'vendor/github.com/labstack/echo/router.go')
-rw-r--r-- | vendor/github.com/labstack/echo/router.go | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/vendor/github.com/labstack/echo/router.go b/vendor/github.com/labstack/echo/router.go index 3af4be0b..ff53da87 100644 --- a/vendor/github.com/labstack/echo/router.go +++ b/vendor/github.com/labstack/echo/router.go @@ -21,15 +21,16 @@ type ( kind uint8 children []*node methodHandler struct { - connect HandlerFunc - delete HandlerFunc - get HandlerFunc - head HandlerFunc - options HandlerFunc - patch HandlerFunc - post HandlerFunc - put HandlerFunc - trace HandlerFunc + connect HandlerFunc + delete HandlerFunc + get HandlerFunc + head HandlerFunc + options HandlerFunc + patch HandlerFunc + post HandlerFunc + propfind HandlerFunc + put HandlerFunc + trace HandlerFunc } ) @@ -59,8 +60,8 @@ func (r *Router) Add(method, path string, h HandlerFunc) { if path[0] != '/' { path = "/" + path } - ppath := path // Pristine path pnames := []string{} // Param names + ppath := path // Pristine path for i, l := 0, len(path); i < l; i++ { if path[i] == ':' { @@ -225,22 +226,24 @@ func (n *node) findChildByKind(t kind) *node { func (n *node) addHandler(method string, h HandlerFunc) { switch method { + case CONNECT: + n.methodHandler.connect = h + case DELETE: + n.methodHandler.delete = h case GET: n.methodHandler.get = h + case HEAD: + n.methodHandler.head = h + case OPTIONS: + n.methodHandler.options = h + case PATCH: + n.methodHandler.patch = h case POST: n.methodHandler.post = h + case PROPFIND: + n.methodHandler.propfind = h case PUT: n.methodHandler.put = h - case DELETE: - n.methodHandler.delete = h - case PATCH: - n.methodHandler.patch = h - case OPTIONS: - n.methodHandler.options = h - case HEAD: - n.methodHandler.head = h - case CONNECT: - n.methodHandler.connect = h case TRACE: n.methodHandler.trace = h } @@ -248,22 +251,24 @@ func (n *node) addHandler(method string, h HandlerFunc) { func (n *node) findHandler(method string) HandlerFunc { switch method { + case CONNECT: + return n.methodHandler.connect + case DELETE: + return n.methodHandler.delete case GET: return n.methodHandler.get + case HEAD: + return n.methodHandler.head + case OPTIONS: + return n.methodHandler.options + case PATCH: + return n.methodHandler.patch case POST: return n.methodHandler.post + case PROPFIND: + return n.methodHandler.propfind case PUT: return n.methodHandler.put - case DELETE: - return n.methodHandler.delete - case PATCH: - return n.methodHandler.patch - case OPTIONS: - return n.methodHandler.options - case HEAD: - return n.methodHandler.head - case CONNECT: - return n.methodHandler.connect case TRACE: return n.methodHandler.trace default: |