MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestRule_Init_Composite

Function TestRule_Init_Composite

internal/waf/rule_test.go:32–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestRule_Init_Composite(t *testing.T) {
33 rule := NewRule()
34 rule.Param = "${arg.name} ${arg.age}"
35 rule.Operator = RuleOperatorContains
36 rule.Value = "lu"
37 err := rule.Init()
38 if err != nil {
39 t.Fatal(err)
40 }
41 t.Log(rule.singleParam, rule.singleCheckpoint)
42
43 rawReq, err := http.NewRequest(http.MethodGet, "http://teaos.cn/hello?name=lu&age=20", nil)
44 if err != nil {
45 t.Fatal(err)
46 }
47 req := requests.NewTestRequest(rawReq)
48 t.Log(rule.MatchRequest(req))
49}
50
51func TestRule_Test(t *testing.T) {
52 var a = assert.NewAssertion(t)

Callers

nothing calls this directly

Calls 5

InitMethod · 0.95
MatchRequestMethod · 0.95
NewTestRequestFunction · 0.92
LogMethod · 0.80
NewRuleFunction · 0.70

Tested by

no test coverage detected