Merge pull request #265 from aledbf/fix-redirect
Fix rewrite annotation parser
This commit is contained in:
commit
a9b57702a6
2 changed files with 3 additions and 7 deletions
|
@ -52,11 +52,7 @@ func NewParser(br resolver.DefaultBackend) parser.IngressAnnotation {
|
||||||
// ParseAnnotations parses the annotations contained in the ingress
|
// ParseAnnotations parses the annotations contained in the ingress
|
||||||
// rule used to rewrite the defined paths
|
// rule used to rewrite the defined paths
|
||||||
func (a rewrite) Parse(ing *extensions.Ingress) (interface{}, error) {
|
func (a rewrite) Parse(ing *extensions.Ingress) (interface{}, error) {
|
||||||
rt, err := parser.GetStringAnnotation(rewriteTo, ing)
|
rt, _ := parser.GetStringAnnotation(rewriteTo, ing)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
sslRe, err := parser.GetBoolAnnotation(sslRedirect, ing)
|
sslRe, err := parser.GetBoolAnnotation(sslRedirect, ing)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sslRe = a.backendResolver.GetDefaultBackend().SSLRedirect
|
sslRe = a.backendResolver.GetDefaultBackend().SSLRedirect
|
||||||
|
|
|
@ -76,8 +76,8 @@ func (m mockBackend) GetDefaultBackend() defaults.Backend {
|
||||||
func TestWithoutAnnotations(t *testing.T) {
|
func TestWithoutAnnotations(t *testing.T) {
|
||||||
ing := buildIngress()
|
ing := buildIngress()
|
||||||
_, err := NewParser(mockBackend{}).Parse(ing)
|
_, err := NewParser(mockBackend{}).Parse(ing)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
t.Error("Expected error with ingress without annotations")
|
t.Errorf("unexpected error with ingress without annotations: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue