fix: ignore uri query for service pattern matching
This commit is contained in:
parent
2b67655cfd
commit
fcc8b39717
|
@ -45,7 +45,17 @@ type BraceCapture struct {
|
|||
|
||||
// Match returns if this service would handle this HTTP request
|
||||
func (svc *Service) Match(req *http.Request) bool {
|
||||
return req.Method == svc.Method && svc.matchPattern(req.RequestURI)
|
||||
var (
|
||||
uri = req.RequestURI
|
||||
queryIndex = strings.IndexByte(uri, '?')
|
||||
)
|
||||
|
||||
// remove query part for matching the pattern
|
||||
if queryIndex > -1 {
|
||||
uri = uri[:queryIndex]
|
||||
}
|
||||
|
||||
return req.Method == svc.Method && svc.matchPattern(uri)
|
||||
}
|
||||
|
||||
// checks if an uri matches the service's pattern
|
||||
|
|
Loading…
Reference in New Issue