Summer Sale! All accounts are 50% off this week.

Sinnbeck's avatar
Level 102

Testing rate limit is active and works?

Has anyone found a good way to test if rate limiting is active and is working correct for a route?

Just want to make sure that the route has the middleware, and it is cleared upon hitting the method.

0 likes
3 replies
Sinnbeck's avatar
Level 102

@Tray2 Yeah I had a look at that, but I want to make a feature test, not e2e :)

Figured out how to get the max allowed, but not the remaining

    $this->get(route('pickup.show', [
        'drop' => $dropOff->token,
    ]))
        ->assertForbidden()
        ->assertHeader('X-Ratelimit-Limit', 10);
Sinnbeck's avatar
Level 102

Ah think I figured it out

    $this->get(route('pickup.show', [
        'drop' => $dropOff->token,
    ]))
        ->assertForbidden()
        ->assertHeader('X-Ratelimit-Limit', 10)
        ->assertHeader('X-Ratelimit-Remaining', 9);
1 like

Please or to participate in this conversation.