MCPcopy
hub / github.com/OJ/gobuster / BenchmarkRequestWitBody

Function BenchmarkRequestWitBody

libgobuster/http_test.go:107–130  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

105}
106
107func BenchmarkRequestWitBody(b *testing.B) {
108 r, err := randomString(10000)
109 if err != nil {
110 b.Fatal(err)
111 }
112 h := httpServerB(b, r)
113 defer h.Close()
114 var o HTTPOptions
115 log := NewLogger(false)
116 c, err := NewHTTPClient(&o, log)
117 if err != nil {
118 b.Fatalf("Got Error: %v", err)
119 }
120 u, err := url.Parse(h.URL)
121 if err != nil {
122 b.Fatalf("could not parse URL %v: %v", h.URL, err)
123 }
124 for b.Loop() {
125 _, _, _, _, err := c.Request(b.Context(), *u, RequestOptions{ReturnBody: true})
126 if err != nil {
127 b.Fatalf("Got Error: %v", err)
128 }
129 }
130}
131
132func BenchmarkNewHTTPClient(b *testing.B) {
133 r, err := randomString(500)

Callers

nothing calls this directly

Calls 7

RequestMethod · 0.95
randomStringFunction · 0.85
httpServerBFunction · 0.85
NewLoggerFunction · 0.85
NewHTTPClientFunction · 0.85
FatalMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected