From 06158cc413299f489cac80d296f859c7ef85c66e Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 27 May 2025 14:58:57 +0100 Subject: [PATCH] Add timestamp header Signed-off-by: snipe --- app/Http/Middleware/SetAPIResponseHeaders.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Http/Middleware/SetAPIResponseHeaders.php b/app/Http/Middleware/SetAPIResponseHeaders.php index c39565071a..4c4938c8ff 100644 --- a/app/Http/Middleware/SetAPIResponseHeaders.php +++ b/app/Http/Middleware/SetAPIResponseHeaders.php @@ -27,7 +27,8 @@ class SetAPIResponseHeaders extends ThrottleRequests (int) $response->headers->get('X-RateLimit-Remaining') <= (int) $remainingAttempts) { $headers = []; $headers['Retry-After'] = $retryAfter; // this is the only line we changed - $headers['X-RateLimit-Reset'] = $this->availableAt($retryAfter); // this is the only line we changed + $headers['X-RateLimit-Reset'] = $retryAfter; // this is the only line we changed + $headers['X-RateLimit-Reset-Timestamp'] = $this->availableAt($retryAfter); // this is the only line we changed return $headers; } @@ -38,7 +39,8 @@ class SetAPIResponseHeaders extends ThrottleRequests if (! is_null($retryAfter)) { $headers['Retry-After'] = $retryAfter; - $headers['X-RateLimit-Reset'] = $this->availableAt($retryAfter); + $headers['X-RateLimit-Reset'] = $retryAfter; // this is the only line we changed + $headers['X-RateLimit-Reset-Timestamp'] = $this->availableAt($retryAfter); // this is the only line we changed } return $headers; @@ -70,7 +72,8 @@ class SetAPIResponseHeaders extends ThrottleRequests $response, $limit->maxAttempts, $this->calculateRemainingAttempts($limit->key, $limit->maxAttempts), - $this->getTimeUntilNextRetry($limit->key) // this is the only line we changed + $this->getTimeUntilNextRetry($limit->key), // this is the only line we changed + $this->getTimeUntilNextRetry($limit->key), // this is the only line we changed ); }