Skip to content

Commit

Permalink
Merge pull request #12 from mindbox-moscow/test/parseResponseCode
Browse files Browse the repository at this point in the history
Update HttpClientRawResponse.php
  • Loading branch information
QSOFT-DEVOLOPER authored Apr 26, 2019
2 parents 053bab5 + 9ff7879 commit f71bab8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/HttpClients/HttpClientRawResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ private function setHeadersAndCode($rawHeaders)
$headerComponents = explode("\n", (string)$rawHeader);
foreach ($headerComponents as $line) {
if (strpos($line, ': ') === false) {
$httpCode = $this->getHttpResponseCodeFromHeader($line);
$code = $this->getHttpResponseCodeFromHeader($line);
if ($httpCode === 0) {
$httpCode = $code;
} elseif ($httpCode > 0 && $code > 0) {
$httpCode = $code;
}
} else {
list($key, $value) = explode(': ', $line, 2);
$headers[$key] = $value;
Expand Down

0 comments on commit f71bab8

Please sign in to comment.