Skip to content

Commit

Permalink
proxy: test nesting of various types
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hutchinson <[email protected]>
  • Loading branch information
Jason Hutchinson authored and arekkas committed Aug 16, 2018
1 parent a4d3d2d commit 188748d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions proxy/credentials_issuer_headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,32 @@ func TestCredentialsIssuerHeaders(t *testing.T) {
Request: &http.Request{Header: http.Header{}},
Match: http.Header{"X-Issuer": []string{""}},
},
"Nested Extras": {
Session: &AuthenticationSession{
Subject: "foo",
Extra: map[string]interface{}{
"nested": map[string]interface{}{
"int": int(10),
"float64": float64(3.14159),
"bool": true,
},
},
},
Rule: &rule.Rule{ID: "test-rule7"},
Config: json.RawMessage([]byte(`{
"X-Nested-Int": "{{ print .Extra.nested.int }}",
"X-Nested-Float64": "{{ print .Extra.nested.float64 }}",
"X-Nested-Bool": "{{ print .Extra.nested.bool}}",
"X-Nested-Nonexistent": "{{ print .Extra.nested.nil }}"
}`)),
Request: &http.Request{Header: http.Header{}},
Match: http.Header{
"X-Nested-Int": []string{"10"},
"X-Nested-Float64": []string{"3.14159"},
"X-Nested-Bool": []string{"true"},
"X-Nested-Nonexistent": []string{""},
},
},
}

for testName, specs := range testMap {
Expand Down

0 comments on commit 188748d

Please sign in to comment.