Browse Source

Additional code cleanup (see comments on issue #56)

pull/56/head
Raphael Simon 12 years ago
parent
commit
451fd8b779
  1. 2
      regexp.go
  2. 2
      route.go

2
regexp.go

@ -249,7 +249,6 @@ func (v *routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route)
} }
} }
// Store query string variables. // Store query string variables.
if v.queries != nil && len(v.queries) > 0 {
rawQuery := req.URL.RawQuery rawQuery := req.URL.RawQuery
for _, q := range v.queries { for _, q := range v.queries {
queryVars := q.regexp.FindStringSubmatch(rawQuery) queryVars := q.regexp.FindStringSubmatch(rawQuery)
@ -260,7 +259,6 @@ func (v *routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route)
} }
} }
} }
}
// getHost tries its best to return the request host. // getHost tries its best to return the request host.
func getHost(r *http.Request) string { func getHost(r *http.Request) string {

2
route.go

@ -152,13 +152,11 @@ func (r *Route) addRegexpMatcher(tpl string, matchHost, matchPrefix, matchQuery
if err != nil { if err != nil {
return err return err
} }
if r.regexp.queries != nil {
for _, q := range r.regexp.queries { for _, q := range r.regexp.queries {
if err = uniqueVars(rr.varsN, q.varsN); err != nil { if err = uniqueVars(rr.varsN, q.varsN); err != nil {
return err return err
} }
} }
}
if matchHost { if matchHost {
if r.regexp.path != nil { if r.regexp.path != nil {
if err = uniqueVars(rr.varsN, r.regexp.path.varsN); err != nil { if err = uniqueVars(rr.varsN, r.regexp.path.varsN); err != nil {

Loading…
Cancel
Save