Skip to content

Commit

Permalink
Merge branch 'hotfix-0.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
takama committed Aug 20, 2014
2 parents 008b295 + d234c71 commit 60c1c87
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.

/*
Package router 0.2.1 provides fast HTTP request router.
Package router 0.2.2 provides fast HTTP request router.
The router matches incoming requests by the request method and the path.
If a handle is registered for this path and method, the router delegates the
Expand Down Expand Up @@ -185,13 +185,15 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if r.Logger {
log.Println(req.Method, req.URL.Path)
}
if handle, params, ok := r.handlers[req.Method].get(req.URL.Path); ok {
c := &Control{Request: req, Writer: w}
if len(params) > 0 {
c.Params = append(c.Params, params...)
if _, ok := r.handlers[req.Method]; ok {
if handle, params, ok := r.handlers[req.Method].get(req.URL.Path); ok {
c := &Control{Request: req, Writer: w}
if len(params) > 0 {
c.Params = append(c.Params, params...)
}
handle(c)
return
}
handle(c)
return
}
allowed := make([]string, 0, len(r.handlers))
for method, parser := range r.handlers {
Expand Down

0 comments on commit 60c1c87

Please sign in to comment.