MCPcopy Index your code
hub / github.com/supabase/auth / TestTimeoutResponseWriter

Function TestTimeoutResponseWriter

internal/api/middleware_test.go:404–423  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

402}
403
404func 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
425func (ts *MiddlewareTestSuite) TestPerformRateLimitingWithSBFF() {
426 origRateLimitHeader := ts.Config.RateLimitHeader

Callers

nothing calls this directly

Calls 3

timeoutMiddlewareFunction · 0.85
EqualMethod · 0.80
ServeHTTPMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…