Add CORS max age annotation (#1888)

Add cors-max-age annotation
This commit is contained in:
Márk Sági-Kazár 2018-01-09 12:19:42 +01:00 committed by Manuel Alejandro de Brito Fontes
parent 5973bec599
commit 313fdd2d1a
5 changed files with 22 additions and 1 deletions

View file

@ -71,6 +71,7 @@ func TestIngressCorsConfig(t *testing.T) {
data[parser.GetAnnotationWithPrefix("cors-allow-credentials")] = "false"
data[parser.GetAnnotationWithPrefix("cors-allow-methods")] = "PUT, GET,OPTIONS, PATCH, $nginx_version"
data[parser.GetAnnotationWithPrefix("cors-allow-origin")] = "https://origin123.test.com:4443"
data[parser.GetAnnotationWithPrefix("cors-max-age")] = "600"
ing.SetAnnotations(data)
corst, _ := NewParser(&resolver.Mock{}).Parse(ing)
@ -95,4 +96,7 @@ func TestIngressCorsConfig(t *testing.T) {
t.Errorf("expected origin https://origin123.test.com:4443, but got %v", nginxCors.CorsAllowOrigin)
}
if nginxCors.CorsMaxAge != 600 {
t.Errorf("expected max age 600, but got %v", nginxCors.CorsMaxAge)
}
}