Skip to content

Commit

Permalink
Throw ThrottleRequestsException during throttling of requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Comeau committed Mar 1, 2018
1 parent 1cc5997 commit d84eeac
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Illuminate/Routing/Middleware/ThrottleRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Cache\RateLimiter;
use Illuminate\Support\InteractsWithTime;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Http\Exceptions\ThrottleRequestsException;

class ThrottleRequests
{
Expand Down Expand Up @@ -40,7 +40,7 @@ public function __construct(RateLimiter $limiter)
* @param int|string $maxAttempts
* @param float|int $decayMinutes
* @return mixed
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
* @throws \Illuminate\Http\Exceptions\ThrottleRequestsException
*/
public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes = 1)
{
Expand Down Expand Up @@ -107,7 +107,7 @@ protected function resolveRequestSignature($request)
*
* @param string $key
* @param int $maxAttempts
* @return \Symfony\Component\HttpKernel\Exception\HttpException
* @return \Illuminate\Http\Exceptions\ThrottleRequestsException
*/
protected function buildException($key, $maxAttempts)
{
Expand All @@ -119,8 +119,8 @@ protected function buildException($key, $maxAttempts)
$retryAfter
);

return new HttpException(
429, 'Too Many Attempts.', null, $headers
return new ThrottleRequestsException(
'Too Many Attempts.', null, $headers
);
}

Expand Down

0 comments on commit d84eeac

Please sign in to comment.