Skip to content

Commit

Permalink
add "contains" field to custom cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
anthocf committed Aug 27, 2024
1 parent e4ee7f2 commit 964099d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rulesets.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ type RulesetRuleActionParametersCustomKey struct {

type RulesetRuleActionParametersCustomKeyHeader struct {
RulesetRuleActionParametersCustomKeyFields
ExcludeOrigin *bool `json:"exclude_origin,omitempty"`
ExcludeOrigin *bool `json:"exclude_origin,omitempty"`
Contains map[string][]string `json:"contains,omitempty"`
}

type RulesetRuleActionParametersCustomKeyCookie RulesetRuleActionParametersCustomKeyFields
Expand Down
5 changes: 4 additions & 1 deletion rulesets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func TestGetRuleset_SetCacheSettings(t *testing.T) {
"ignore_query_strings_order":true,
"custom_key": {
"query_string":{"include":"*"},
"header":{"include":["habc","hdef"],"check_presence":["hfizz","hbuzz"],"exclude_origin":true},
"header":{"include":["habc","hdef"],"check_presence":["hfizz","hbuzz"],"exclude_origin":true,"contains":{"accept":["image/web", "image/png"]}},
"cookie":{"include":["cabc","cdef"],"check_presence":["cfizz","cbuzz"]},
"user":{
"device_type":true,
Expand Down Expand Up @@ -316,6 +316,9 @@ func TestGetRuleset_SetCacheSettings(t *testing.T) {
CheckPresence: []string{"hfizz", "hbuzz"},
},
ExcludeOrigin: BoolPtr(true),
Contains: map[string][]string{
"accept": {"image/web", "image/png"},
},
},
Cookie: &RulesetRuleActionParametersCustomKeyCookie{
Include: []string{"cabc", "cdef"},
Expand Down

0 comments on commit 964099d

Please sign in to comment.