Skip to content

Commit c0fe795

Browse files
authored
Merge pull request #136 from rjacobso/dev-cursor-pagination
Add support for cursor based pagination (again)
2 parents 60f9355 + bde5936 commit c0fe795

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/CurlRequest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ class CurlRequest
2828
*/
2929
public static $lastHttpCode;
3030

31+
/**
32+
* HTTP response headers of last executed request
33+
*
34+
* @var array
35+
*/
36+
public static $lastHttpResponseHeaders = array();
3137

3238
/**
3339
* Initialize the curl resource
@@ -170,7 +176,9 @@ protected static function processRequest($ch)
170176
// close curl resource to free up system resources
171177
curl_close($ch);
172178

179+
self::$lastHttpResponseHeaders = $response->getHeaders();
180+
173181
return $response->getBody();
174182
}
175-
183+
176184
}

lib/ShopifyResource.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ abstract class ShopifyResource
3131
*/
3232
protected $httpHeaders = array();
3333

34+
/**
35+
* HTTP response headers of last executed request
36+
*
37+
* @var array
38+
*/
39+
public static $lastHttpResponseHeaders = array();
40+
3441
/**
3542
* The base URL of the API Resource (excluding the '.json' extension).
3643
*
@@ -511,6 +518,8 @@ protected function castString($array)
511518
*/
512519
public function processResponse($responseArray, $dataKey = null)
513520
{
521+
self::$lastHttpResponseHeaders = CurlRequest::$lastHttpResponseHeaders;
522+
514523
if ($responseArray === null) {
515524
//Something went wrong, Checking HTTP Codes
516525
$httpOK = 200; //Request Successful, OK.
@@ -569,6 +578,7 @@ public function getLink($responseHeaders, $type='next'){
569578
}
570579
}
571580
}
581+
572582
return null;
573583
}
574584

0 commit comments

Comments
 (0)