fix: routing priorities are not working properly (#472)

Signed-off-by: charlie <qianglin98@qq.com>
This commit is contained in:
Qianglin Li
2023-08-11 09:55:33 +08:00
committed by GitHub
parent 35d5669b51
commit 49269b4303
5 changed files with 69 additions and 6 deletions

View File

@@ -170,7 +170,14 @@ func SortHTTPRoutes(routes []*WrapperHTTPRoute) {
isAllCatch := func(route *WrapperHTTPRoute) bool {
if route.OriginPathType == Prefix && route.OriginPath == "/" {
return true
if route.HTTPRoute.Match == nil {
return true
}
match := route.HTTPRoute.Match[0]
if len(match.Headers) == 0 && len(match.QueryParams) == 0 && match.Method == nil {
return true
}
}
return false
}