Skip to content

Commit

Permalink
fix an error for parse response
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Sep 16, 2021
1 parent bd250df commit 5d9b761
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Curl/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
use const CURLOPT_PUT;
use const CURLOPT_REFERER;
use const CURLOPT_RETURNTRANSFER;
use const CURLOPT_SAFE_UPLOAD;
use const CURLOPT_SSL_VERIFYHOST;
use const CURLOPT_SSL_VERIFYPEER;
use const CURLOPT_SSLCERT;
Expand Down Expand Up @@ -338,7 +337,7 @@ public function request(string $url, $data = null, string $method = 'GET', array
$this->setResponseParsed(true);
} else {
// if CURLOPT_HEADER is TRUE, The raw response data contains headers and body
$this->rawResponse = (string)$response;
$this->rawResponse = $response;
$this->parseResponse(); // parse raw response data
}

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/ParseRawResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function parseResponse(): void

// Extract headers from response
preg_match_all($pattern, $response, $matches);
$headersString = array_pop($matches[0]);
$headersString = (string)array_pop($matches[0]);

$headers = explode("\r\n", str_replace("\r\n\r\n", '', $headersString));
// parse headers
Expand Down

0 comments on commit 5d9b761

Please sign in to comment.