1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

Update api.php

This commit is contained in:
Bradley Schofield 2021-11-09 14:52:32 +00:00
parent eb73bee093
commit a101c06c62

View file

@ -57,7 +57,7 @@ App::init(function ($utopia, $request, $response, $project, $user, $register, $e
//TODO make sure we get array here
$closestLimit = 999;
$closestLimit = null;
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::$roles);
$isAppUser = Auth::isAppUser(Authorization::$roles);
@ -70,7 +70,7 @@ App::init(function ($utopia, $request, $response, $project, $user, $register, $e
$abuse = new Abuse($timeLimit);
if ($timeLimit->limit() && $timeLimit->remaining() < $closestLimit) {
if ($timeLimit->limit() && $timeLimit->remaining() < $closestLimit || is_null($closestLimit)) {
$closestLimit = $timeLimit->remaining();
$response
->addHeader('X-RateLimit-Limit', $timeLimit->limit())