Rearrange rules for matching strict slash
This commit is contained in:
@@ -35,12 +35,13 @@ func newRouteRegexp(tpl string, matchHost, matchPrefix, matchQuery, strictSlash
|
|||||||
defaultPattern := "[^/]+"
|
defaultPattern := "[^/]+"
|
||||||
if matchQuery {
|
if matchQuery {
|
||||||
defaultPattern = "[^?&]+"
|
defaultPattern = "[^?&]+"
|
||||||
matchPrefix, strictSlash = true, false
|
matchPrefix = true
|
||||||
} else if matchHost {
|
} else if matchHost {
|
||||||
defaultPattern = "[^.]+"
|
defaultPattern = "[^.]+"
|
||||||
matchPrefix, strictSlash = false, false
|
matchPrefix = false
|
||||||
}
|
}
|
||||||
if matchPrefix {
|
// Only match strict slash if not matching
|
||||||
|
if matchPrefix || matchHost || matchQuery {
|
||||||
strictSlash = false
|
strictSlash = false
|
||||||
}
|
}
|
||||||
// Set a flag for strictSlash.
|
// Set a flag for strictSlash.
|
||||||
|
|||||||
Reference in New Issue
Block a user