@ -151,10 +151,11 @@ func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
@@ -151,10 +151,11 @@ func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
if ! r . matchHost {
if r . matchQuery {
return r . matchQueryString ( req )
} else {
return r . regexp . MatchString ( req . URL . Path )
}
return r . regexp . MatchString ( req . URL . Path )
}
return r . regexp . MatchString ( getHost ( req ) )
}
@ -184,10 +185,10 @@ func (r *routeRegexp) url(values map[string]string) (string, error) {
@@ -184,10 +185,10 @@ func (r *routeRegexp) url(values map[string]string) (string, error) {
return rv , nil
}
// getUrl Query returns a single query parameter from a request URL.
// getURL Query returns a single query parameter from a request URL.
// For a URL with foo=bar&baz=ding, we return only the relevant key
// value pair for the routeRegexp.
func ( r * routeRegexp ) getUrl Query ( req * http . Request ) string {
func ( r * routeRegexp ) getURL Query ( req * http . Request ) string {
if ! r . matchQuery {
return ""
}
@ -201,14 +202,14 @@ func (r *routeRegexp) getUrlQuery(req *http.Request) string {
@@ -201,14 +202,14 @@ func (r *routeRegexp) getUrlQuery(req *http.Request) string {
}
func ( r * routeRegexp ) matchQueryString ( req * http . Request ) bool {
return r . regexp . MatchString ( r . getUrl Query ( req ) )
return r . regexp . MatchString ( r . getURL Query ( req ) )
}
// braceIndices returns the first level curly brace indices from a string.
// It returns an error in case of unbalanced braces.
func braceIndices ( s string ) ( [ ] int , error ) {
var level , idx int
idxs := make ( [ ] int , 0 )
var idxs [ ] int
for i := 0 ; i < len ( s ) ; i ++ {
switch s [ i ] {
case '{' :
@ -278,10 +279,10 @@ func (v *routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route)
@@ -278,10 +279,10 @@ func (v *routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route)
}
// Store query string variables.
for _ , q := range v . queries {
queryUrl := q . getUrl Query ( req )
matches := q . regexp . FindStringSubmatchIndex ( queryUrl )
queryURL := q . getURL Query ( req )
matches := q . regexp . FindStringSubmatchIndex ( queryURL )
if len ( matches ) > 0 {
extractVars ( queryUrl , matches , q . varsN , m . Vars )
extractVars ( queryURL , matches , q . varsN , m . Vars )
}
}
}