(t *testing.T)
| 367 | } |
| 368 | |
| 369 | func TestRateLimitDoesNotCrash(t *testing.T) { |
| 370 | resetTestState() |
| 371 | |
| 372 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 373 | w.WriteHeader(http.StatusTooManyRequests) |
| 374 | fmt.Fprint(w, "Rate limited") |
| 375 | })) |
| 376 | defer ts.Close() |
| 377 | |
| 378 | payloadsDir := setupPayloadsDir(t) |
| 379 | |
| 380 | opts := RequestOptions{ |
| 381 | uri: ts.URL + "/admin", |
| 382 | headers: []header{{"User-Agent", "test"}}, |
| 383 | method: "GET", |
| 384 | proxy: &url.URL{}, |
| 385 | folder: payloadsDir, |
| 386 | timeout: 5000, |
| 387 | rateLimit: true, |
| 388 | redirect: false, |
| 389 | verbose: true, |
| 390 | } |
| 391 | |
| 392 | // This should NOT crash (previously would log.Fatalf) |
| 393 | requestMethods(opts) |
| 394 | requestHeaders(opts) |
| 395 | requestEndPaths(opts) |
| 396 | } |
| 397 | |
| 398 | func TestMissingPayloadFileDoesNotCrash(t *testing.T) { |
| 399 | resetTestState() |
nothing calls this directly
no test coverage detected