Adds more units tests

This commit is contained in:
Manu Mtz-Almeida
2015-06-04 04:50:40 +02:00
parent ee021d06ea
commit 92475baba6
2 changed files with 29 additions and 0 deletions
+4
View File
@@ -7,6 +7,7 @@ package gin
import (
"net/http"
"path"
"regexp"
"strings"
)
@@ -50,6 +51,9 @@ func (group *RouterGroup) handle(httpMethod, relativePath string, handlers Handl
}
func (group *RouterGroup) Handle(httpMethod, relativePath string, handlers ...HandlerFunc) {
if matches, err := regexp.MatchString("^[A-Z]+$", httpMethod); !matches || err != nil {
panic("http method " + httpMethod + " is not valid")
}
group.handle(httpMethod, relativePath, handlers)
}