From 3c27d65bd05eb9de549ff4a60f24ced4d251339a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gon=C3=A7alves?= Date: Wed, 14 Dec 2016 12:53:46 +0000 Subject: [PATCH] Update rate limit headers This updates the following rate limit headers: * X-RateLimit-Remaining to Rate-Limit-Remaining * X-RateLimit-Reset to Rate-Limit-Reset * X-RateLimit-Limit to Rate-Limit-Total --- lib/Uphold/HttpClient/Message/Response.php | 6 +++--- .../Tests/Unit/HttpClient/Handler/ErrorHandlerTest.php | 6 +++--- test/Uphold/Tests/Unit/HttpClient/Message/ResponseTest.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Uphold/HttpClient/Message/Response.php b/lib/Uphold/HttpClient/Message/Response.php index 0852275..79485ae 100644 --- a/lib/Uphold/HttpClient/Message/Response.php +++ b/lib/Uphold/HttpClient/Message/Response.php @@ -17,9 +17,9 @@ class Response extends BaseResponse public function getApiRateLimit() { return array( - 'limit' => (string) $this->getHeader('X-RateLimit-Limit'), - 'remaining' => (string) $this->getHeader('X-RateLimit-Remaining'), - 'reset' => (string) $this->getHeader('X-RateLimit-Reset'), + 'limit' => (string) $this->getHeader('Rate-Limit-Total'), + 'remaining' => (string) $this->getHeader('Rate-Limit-Remaining'), + 'reset' => (string) $this->getHeader('Rate-Limit-Reset'), ); } diff --git a/test/Uphold/Tests/Unit/HttpClient/Handler/ErrorHandlerTest.php b/test/Uphold/Tests/Unit/HttpClient/Handler/ErrorHandlerTest.php index 62c912f..44b4cdf 100644 --- a/test/Uphold/Tests/Unit/HttpClient/Handler/ErrorHandlerTest.php +++ b/test/Uphold/Tests/Unit/HttpClient/Handler/ErrorHandlerTest.php @@ -209,9 +209,9 @@ public function shouldThrowApiLimitExceedException() ->expects($this->exactly(3)) ->method('getHeader') ->withConsecutive( - array('X-RateLimit-Limit'), - array('X-RateLimit-Remaining'), - array('X-RateLimit-Reset') + array('Rate-Limit-Total'), + array('Rate-Limit-Remaining'), + array('Rate-Limit-Reset') ) ->will($this->onConsecutiveCalls(300, 0, 1384377793)) ; diff --git a/test/Uphold/Tests/Unit/HttpClient/Message/ResponseTest.php b/test/Uphold/Tests/Unit/HttpClient/Message/ResponseTest.php index 1b7b300..383c71e 100644 --- a/test/Uphold/Tests/Unit/HttpClient/Message/ResponseTest.php +++ b/test/Uphold/Tests/Unit/HttpClient/Message/ResponseTest.php @@ -306,9 +306,9 @@ public function shouldReturnResponseApiRateLimit() ->expects($this->exactly(3)) ->method('getHeader') ->withConsecutive( - array('X-RateLimit-Limit'), - array('X-RateLimit-Remaining'), - array('X-RateLimit-Reset') + array('Rate-Limit-Total'), + array('Rate-Limit-Remaining'), + array('Rate-Limit-Reset') ) ->will($this->onConsecutiveCalls($data['limit'], $data['remaining'], $data['reset'])) ;