Skip to content

Commit

Permalink
Return response from named limiter (#34325)
Browse files Browse the repository at this point in the history
If a named limiter returns a Response object, the `handleRequestUsingNamedLimiter` tried to return the unset variable `$limit`.

Instead, it should return the actual response created by the named limiter.
  • Loading branch information
Marton Farago authored Sep 14, 2020
1 parent 96ee350 commit efcb7e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/Middleware/ThrottleRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function handleRequestUsingNamedLimiter($request, Closure $next, $limi
$limiterResponse = call_user_func($limiter, $request);

if ($limiterResponse instanceof Response) {
return $limit;
return $limiterResponse;
} elseif ($limiterResponse instanceof Unlimited) {
return $next($request);
}
Expand Down

0 comments on commit efcb7e9

Please sign in to comment.