Simplify x-forwarded-prefix annotation
This commit is contained in:
parent
1ed1dd588a
commit
188295550c
7 changed files with 106 additions and 22 deletions
|
|
@ -99,7 +99,7 @@ type Ingress struct {
|
|||
LoadBalancing string
|
||||
UpstreamVhost string
|
||||
Whitelist ipwhitelist.SourceRange
|
||||
XForwardedPrefix bool
|
||||
XForwardedPrefix string
|
||||
SSLCiphers string
|
||||
Logs log.Config
|
||||
LuaRestyWAF luarestywaf.Config
|
||||
|
|
|
|||
|
|
@ -35,5 +35,5 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation {
|
|||
// Parse parses the annotations contained in the ingress rule
|
||||
// used to add an x-forwarded-prefix header to the request
|
||||
func (cbbs xforwardedprefix) Parse(ing *extensions.Ingress) (interface{}, error) {
|
||||
return parser.GetBoolAnnotation("x-forwarded-prefix", ing)
|
||||
return parser.GetStringAnnotation("x-forwarded-prefix", ing)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ func TestParse(t *testing.T) {
|
|||
|
||||
testCases := []struct {
|
||||
annotations map[string]string
|
||||
expected bool
|
||||
expected string
|
||||
}{
|
||||
{map[string]string{annotation: "true"}, true},
|
||||
{map[string]string{annotation: "1"}, true},
|
||||
{map[string]string{annotation: ""}, false},
|
||||
{map[string]string{}, false},
|
||||
{nil, false},
|
||||
{map[string]string{annotation: "true"}, "true"},
|
||||
{map[string]string{annotation: "1"}, "1"},
|
||||
{map[string]string{annotation: ""}, ""},
|
||||
{map[string]string{}, ""},
|
||||
{nil, ""},
|
||||
}
|
||||
|
||||
ing := &extensions.Ingress{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue