Skip to content

Commit 91a7f96

Browse files
nfrpstloyd
authored andcommitted
Fixed pagination retrieval.
Per the Github API v3 documentation: "The linebreak is included for readability". The actual pagination separator is ",". Ref: http://developer.github.com/v3/#pagination
1 parent 2f94518 commit 91a7f96

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Github/HttpClient/HttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ protected function decodePagination(MessageInterface $response)
230230
}
231231

232232
$pagination = array();
233-
foreach (explode("\n", $header) as $link) {
233+
foreach (explode(',', $header) as $link) {
234234
preg_match('/<(.*)>; rel="(.*)"/i', trim($link, ','), $match);
235235

236236
if (3 === count($match)) {

test/Github/Tests/HttpClient/HttpClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Buzz\Message\Response;
77

88
/**
9-
* HttpClient test case
9+
* HttpClient test case
1010
*
1111
* @author Leszek Prabucki <[email protected]>
1212
*/
@@ -166,7 +166,7 @@ public function shouldHandlePagination()
166166
$options = array('c' => 'd');
167167

168168
$response = new Response();
169-
$response->addHeader("Link:<page1>; rel=\"page2\"\n<page3>; rel=\"page4\"");
169+
$response->addHeader("Link:<page1>; rel=\"page2\", \n<page3>; rel=\"page4\"");
170170

171171
$browser = $this->getBrowserMock();
172172
$browser

0 commit comments

Comments
 (0)