From 0e748c6871bbece45c941fb26d6fa869ea656221 Mon Sep 17 00:00:00 2001 From: astaxie Date: Sat, 27 Jul 2013 10:55:10 +0800 Subject: [PATCH] parse url to params /object/login/2009/07/11 parse to ObjectController Login function params:map[0:2009 1:07 2:11] --- router.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/router.go b/router.go index 1892ce13..2d00f061 100644 --- a/router.go +++ b/router.go @@ -548,9 +548,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) if strings.HasPrefix(strings.ToLower(requestPath), "/"+cName+"/"+strings.ToLower(mName)) { //parse params otherurl := requestPath[len("/"+cName+"/"+strings.ToLower(mName)):] - if len(otherurl) > 1 && otherurl[0] != '/' { + if len(otherurl) > 1 { plist := strings.Split(otherurl, "/") - for k, v := range plist { + for k, v := range plist[1:] { params[strconv.Itoa(k)] = v } } -- GitLab