Skip to content

Commit 0d86fc5

Browse files
authored
Merge pull request #221 from liamjcooper/fix/discount-lookup
Return location header as array if response is 303
2 parents b7dc4b7 + c2e1441 commit 0d86fc5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ShopifyResource.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,15 @@ public function processResponse($responseArray, $dataKey = null)
531531
$httpOK = 200; //Request Successful, OK.
532532
$httpCreated = 201; //Create Successful.
533533
$httpDeleted = 204; //Delete Successful
534+
$httpOther = 303; //See other (headers).
534535

535536
//should be null if any other library used for http calls
536537
$httpCode = CurlRequest::$lastHttpCode;
537538

539+
if ($httpCode == $httpOther && array_key_exists('location', self::$lastHttpResponseHeaders)) {
540+
return ['location' => self::$lastHttpResponseHeaders['location']];
541+
}
542+
538543
if ($httpCode != null && $httpCode != $httpOK && $httpCode != $httpCreated && $httpCode != $httpDeleted) {
539544
throw new Exception\CurlException("Request failed with HTTP Code $httpCode.", $httpCode);
540545
}

0 commit comments

Comments
 (0)