(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func Test_Template2(t *testing.T) { |
| 43 | reader := bytes.NewReader([]byte(strings.Repeat("HELLO", 1024))) |
| 44 | req, err := http.NewRequest(http.MethodPost, "https://example.com/index.php?id=123", reader) |
| 45 | if err != nil { |
| 46 | t.Fatal(err) |
| 47 | } |
| 48 | |
| 49 | wafInstance, err := waf.Template() |
| 50 | if err != nil { |
| 51 | t.Fatal(err) |
| 52 | } |
| 53 | |
| 54 | now := time.Now() |
| 55 | result, err := wafInstance.MatchRequest(requests.NewTestRequest(req), nil, firewallconfigs.ServerCaptchaTypeNone) |
| 56 | if err != nil { |
| 57 | t.Fatal(err) |
| 58 | } |
| 59 | t.Log(time.Since(now).Seconds()*1000, "ms") |
| 60 | |
| 61 | if result.GoNext { |
| 62 | t.Log("ok") |
| 63 | return |
| 64 | } |
| 65 | |
| 66 | logs.PrintAsJSON(result.Set, t) |
| 67 | } |
| 68 | |
| 69 | func BenchmarkTemplate(b *testing.B) { |
| 70 | runtime.GOMAXPROCS(4) |
nothing calls this directly
no test coverage detected