(t *testing.T)
| 402 | } |
| 403 | |
| 404 | func TestTimeoutResponseWriter(t *testing.T) { |
| 405 | // timeoutResponseWriter should exhitbit a similar behavior as http.ResponseWriter |
| 406 | req := httptest.NewRequest(http.MethodGet, "http://localhost", nil) |
| 407 | w1 := httptest.NewRecorder() |
| 408 | w2 := httptest.NewRecorder() |
| 409 | |
| 410 | timeoutHandler := timeoutMiddleware(time.Second * 10) |
| 411 | |
| 412 | redirectHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 413 | // tries to redirect twice |
| 414 | http.Redirect(w, r, "http://localhost:3001/#message=first_message", http.StatusSeeOther) |
| 415 | |
| 416 | // overwrites the first |
| 417 | http.Redirect(w, r, "http://localhost:3001/second", http.StatusSeeOther) |
| 418 | }) |
| 419 | timeoutHandler(redirectHandler).ServeHTTP(w1, req) |
| 420 | redirectHandler.ServeHTTP(w2, req) |
| 421 | |
| 422 | require.Equal(t, w1.Result(), w2.Result()) |
| 423 | } |
| 424 | |
| 425 | func (ts *MiddlewareTestSuite) TestPerformRateLimitingWithSBFF() { |
| 426 | origRateLimitHeader := ts.Config.RateLimitHeader |
nothing calls this directly
no test coverage detected
searching dependent graphs…