Refactor Exact path matthing

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-10-19 22:38:05 -03:00
parent 703c2d6f8e
commit cdd6437380
2 changed files with 3 additions and 3 deletions

View file

@ -406,7 +406,7 @@ func buildLocation(input interface{}, enforceRegex bool) string {
}
if location.PathType != nil && *location.PathType == networkingv1beta1.PathTypeExact {
return fmt.Sprintf(`= %s`, path)
return fmt.Sprintf(`~ ^%s$`, path)
}
return path

View file

@ -60,7 +60,7 @@ var _ = framework.IngressNginxDescribe("[Ingress] [PathType] exact", func() {
f.WaitForNginxServer(host,
func(server string) bool {
return strings.Contains(server, host) &&
strings.Contains(server, "location = /exact") &&
strings.Contains(server, "location ~ ^/exact$") &&
strings.Contains(server, "location /exact")
})
@ -98,7 +98,7 @@ var _ = framework.IngressNginxDescribe("[Ingress] [PathType] exact", func() {
f.WaitForNginxServer(host,
func(server string) bool {
return strings.Contains(server, host) &&
strings.Contains(server, "location = /exact") &&
strings.Contains(server, "location ~ ^/exact$") &&
strings.Contains(server, "location /exact")
})