Disable rate limiter in Laravel?

Is there a way to disable rate limiting on every/individual routes in Laravel?

I'm trying to test an endpoint that receives a lot of requests, but randomly Laravel will start responding with { status: 429, responseText: 'Too Many Attempts.' } for a few hundred requests which makes testing a huge pain.


In app/Http/Kernel.php Laravel has a default throttle limit for all api routes.

protected $middlewareGroups = [
    ...
    'api' => [
        'throttle:60,1',
    ],
];

Comment or increase it.


You can actually disable only a certain middleware in tests.

use Illuminate\Routing\Middleware\ThrottleRequests;

class YourTest extends TestCase 
{

    protected function setUp()
    {
        parent::setUp();
        $this->withoutMiddleware(
            ThrottleRequests::class
        );
    }
    ...
}