Skip to content
Permalink
Browse files

fix bug introduce in previous commit

  • Loading branch information...
RobinDev committed Jan 17, 2019
1 parent 6094293 commit 64b5cbe5b92f72073942a44e9c11ff4337012566
Showing with 21 additions and 1 deletion.
  1. +1 −1 src/Response.php
  2. +20 −0 tests/HelperTest.php
@@ -67,7 +67,7 @@ public function getContent()
public function getHeaders(bool $returnArray = true)
{
if (isset($this->headers)) {
return true === $returnArray ? Helper::parseHeader($this->headers) : $this->headers;
return true === $returnArray ? Helper::httpParseHeaders($this->headers) : $this->headers;
}
}
@@ -4,6 +4,7 @@
namespace PiedWeb\Curl\Test;
use PiedWeb\Curl\Request;
use PiedWeb\Curl\Helper;
class HelperTest extends \PHPUnit\Framework\TestCase
@@ -31,4 +32,23 @@ public function testCheckStatusCode()
$expected = 200;
$this->assertTrue(Helper::checkStatusCode($line, $expected));
}
public function testHeaderParsing()
{
$url = 'https://piedweb.com/';
$request = new Request($url);
$request
->setDefaultGetOptions()
->setReturnHeader()
->setDesktopUserAgent()
;
$result = $request->exec();
$headers = $result->getHeaders(false);
$this->assertTrue(is_string($headers));
//var_dump(Helper::httpParseHeaders($headers));
//var_dump(Helper::parseHeader($headers));
}
}

0 comments on commit 64b5cbe

Please sign in to comment.
You can’t perform that action at this time.