(t *testing.T)
| 216 | } |
| 217 | |
| 218 | func TestResponseBodyCapture(t *testing.T) { |
| 219 | t.Parallel() |
| 220 | |
| 221 | want := []byte("VEGETA") |
| 222 | server := httptest.NewServer( |
| 223 | http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 224 | w.Write(want) |
| 225 | }), |
| 226 | ) |
| 227 | defer server.Close() |
| 228 | atk := NewAttacker() |
| 229 | tr := NewStaticTargeter(Target{Method: "GET", URL: server.URL}) |
| 230 | |
| 231 | res := atk.hit(tr, &attack{name: "", began: time.Now()}) |
| 232 | if got := res.Body; !bytes.Equal(got, want) { |
| 233 | t.Fatalf("got: %v, want: %v", got, want) |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | func TestProxyOption(t *testing.T) { |
| 238 | t.Parallel() |
nothing calls this directly
no test coverage detected