File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33// license that can be found in the LICENSE file.
44
55/*
6- Package router 0.2.1 provides fast HTTP request router.
6+ Package router 0.2.2 provides fast HTTP request router.
77
88The router matches incoming requests by the request method and the path.
99If a handle is registered for this path and method, the router delegates the
@@ -185,13 +185,15 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
185185 if r .Logger {
186186 log .Println (req .Method , req .URL .Path )
187187 }
188- if handle , params , ok := r .handlers [req .Method ].get (req .URL .Path ); ok {
189- c := & Control {Request : req , Writer : w }
190- if len (params ) > 0 {
191- c .Params = append (c .Params , params ... )
188+ if _ , ok := r .handlers [req .Method ]; ok {
189+ if handle , params , ok := r .handlers [req .Method ].get (req .URL .Path ); ok {
190+ c := & Control {Request : req , Writer : w }
191+ if len (params ) > 0 {
192+ c .Params = append (c .Params , params ... )
193+ }
194+ handle (c )
195+ return
192196 }
193- handle (c )
194- return
195197 }
196198 allowed := make ([]string , 0 , len (r .handlers ))
197199 for method , parser := range r .handlers {
You can’t perform that action at this time.
0 commit comments