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

Function TestRule_Init_Single

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

Source from the content-addressed store, hash-verified

11)
12
13func TestRule_Init_Single(t *testing.T) {
14 rule := NewRule()
15 rule.Param = "${arg.name}"
16 rule.Operator = RuleOperatorEqString
17 rule.Value = "lu"
18 err := rule.Init()
19 if err != nil {
20 t.Fatal(err)
21 }
22 t.Log(rule.singleParam, rule.singleCheckpoint)
23 rawReq, err := http.NewRequest(http.MethodGet, "http://teaos.cn/hello?name=lu&age=20", nil)
24 if err != nil {
25 t.Fatal(err)
26 }
27
28 req := requests.NewTestRequest(rawReq)
29 t.Log(rule.MatchRequest(req))
30}
31
32func TestRule_Init_Composite(t *testing.T) {
33 rule := NewRule()

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