(b *testing.B, script string, params ...string)
| 1039 | } |
| 1040 | |
| 1041 | func benchmarkRequest(b *testing.B, script string, params ...string) { |
| 1042 | f, _ := newFilter(LuaOptions{}, script, params...) |
| 1043 | |
| 1044 | r, _ := http.NewRequest("GET", "http://example.com/test", nil) |
| 1045 | r.Header.Add("X-Foo", "Bar") |
| 1046 | fc := &filtertest.Context{FRequest: r} |
| 1047 | |
| 1048 | b.ResetTimer() |
| 1049 | for i := 0; i < b.N; i++ { |
| 1050 | f.Request(fc) |
| 1051 | } |
| 1052 | } |
| 1053 | |
| 1054 | func BenchmarkScriptRandomPath(b *testing.B) { |
| 1055 | benchmarkRequest(b, "testdata/random_path.lua", "/prefix/", "10") |
no test coverage detected
searching dependent graphs…