MCPcopy Create free account
hub / github.com/devploit/nomore403 / TestRateLimitDoesNotCrash

Function TestRateLimitDoesNotCrash

cmd/bypass_test.go:369–396  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

367}
368
369func 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
398func TestMissingPayloadFileDoesNotCrash(t *testing.T) {
399 resetTestState()

Callers

nothing calls this directly

Calls 5

resetTestStateFunction · 0.85
setupPayloadsDirFunction · 0.85
requestMethodsFunction · 0.85
requestHeadersFunction · 0.85
requestEndPathsFunction · 0.85

Tested by

no test coverage detected