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

Function BenchmarkRequestWithoutBody

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

Source from the content-addressed store, hash-verified

80}
81
82func BenchmarkRequestWithoutBody(b *testing.B) {
83 r, err := randomString(10000)
84 if err != nil {
85 b.Fatal(err)
86 }
87 h := httpServerB(b, r)
88 defer h.Close()
89 var o HTTPOptions
90 log := NewLogger(false)
91 c, err := NewHTTPClient(&o, log)
92 if err != nil {
93 b.Fatalf("Got Error: %v", err)
94 }
95 u, err := url.Parse(h.URL)
96 if err != nil {
97 b.Fatalf("could not parse URL %v: %v", h.URL, err)
98 }
99 for b.Loop() {
100 _, _, _, _, err := c.Request(b.Context(), *u, RequestOptions{ReturnBody: false})
101 if err != nil {
102 b.Fatalf("Got Error: %v", err)
103 }
104 }
105}
106
107func BenchmarkRequestWitBody(b *testing.B) {
108 r, err := randomString(10000)

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