Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/VCR/LibraryHooks/CurlHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public static function curlGetinfo(CurlHandle $curlHandle, int $option = 0)
if (isset(self::$responses[(int) $curlHandle])) {
return CurlHelper::getCurlOptionFromResponse(
self::$responses[(int) $curlHandle],
self::$requests[(int) $curlHandle]->getUrl(),
$option
);
} elseif (isset(self::$lastErrors[(int) $curlHandle])) {
Expand Down
9 changes: 7 additions & 2 deletions src/VCR/Util/CurlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ public static function handleOutput(Response $response, array $curlOptions, Curl
}

/**
* @param int $option cURL option to get
* @param Response $response response to get cURL option from
* @param string|null $url the URL this response is for
* @param int $option cURL option to get
*
* @throws \BadMethodCallException
*
* @return mixed value of the cURL option
*/
public static function getCurlOptionFromResponse(Response $response, int $option = 0)
public static function getCurlOptionFromResponse(Response $response, ?string $url, int $option = 0)
{
switch ($option) {
case 0: // 0 == array of all curl options
Expand All @@ -109,6 +111,9 @@ public static function getCurlOptionFromResponse(Response $response, int $option
case \CURLPROXY_HTTPS:
$info = '';
break;
case \CURLINFO_EFFECTIVE_URL:
$info = $url;
break;
default:
$info = $response->getCurlInfo(self::$curlInfoList[$option]);
break;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Util/CurlHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public function testGetCurlOptionFromResponse(Response $response, $curlOption, $
{
$this->assertEquals(
$expectedCurlOptionValue,
CurlHelper::getCurlOptionFromResponse($response, $curlOption)
CurlHelper::getCurlOptionFromResponse($response, '', $curlOption)
);
}

Expand Down