Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices() — fiber Function Reference
Architecture documentation for the Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices() function in limiter_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD a569f03c_72e7_e1b2_838e_46d2825bb8d5["Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices()"] 0509da96_221e_0d0d_fe2e_f2e2e3695b6f["limiter_test.go"] a569f03c_72e7_e1b2_838e_46d2825bb8d5 -->|defined in| 0509da96_221e_0d0d_fe2e_f2e2e3695b6f a70ffa85_f38b_cd52_97fa_bce8a29e5dab["sleepForRetryAfter()"] a569f03c_72e7_e1b2_838e_46d2825bb8d5 -->|calls| a70ffa85_f38b_cd52_97fa_bce8a29e5dab style a569f03c_72e7_e1b2_838e_46d2825bb8d5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/limiter/limiter_test.go lines 1023–1060
func Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Use(New(Config{
Max: 2,
Expiration: 2 * time.Second,
SkipFailedRequests: false,
SkipSuccessfulRequests: false,
Storage: memory.New(),
LimiterMiddleware: SlidingWindow{},
}))
app.Get("/:status", func(c fiber.Ctx) error {
if c.Params("status") == "fail" {
return c.SendStatus(400)
}
return c.SendStatus(200)
})
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/fail", http.NoBody))
require.NoError(t, err)
require.Equal(t, 400, resp.StatusCode)
resp, err = app.Test(httptest.NewRequest(fiber.MethodGet, "/success", http.NoBody))
require.NoError(t, err)
require.Equal(t, 200, resp.StatusCode)
resp, err = app.Test(httptest.NewRequest(fiber.MethodGet, "/success", http.NoBody))
require.NoError(t, err)
require.Equal(t, 429, resp.StatusCode)
sleepForRetryAfter(t, resp)
resp, err = app.Test(httptest.NewRequest(fiber.MethodGet, "/success", http.NoBody))
require.NoError(t, err)
require.Equal(t, 200, resp.StatusCode)
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices() do?
Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices() is a function in the fiber codebase, defined in middleware/limiter/limiter_test.go.
Where is Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices() defined?
Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices() is defined in middleware/limiter/limiter_test.go at line 1023.
What does Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices() call?
Test_Limiter_Sliding_Window_Custom_Storage_No_Skip_Choices() calls 1 function(s): sleepForRetryAfter.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free