Commit 71f8fd50 authored by TheBigB's avatar TheBigB
Browse files

Fixed bug where reponse header was not interpreted properly

parent 26a756ed
......@@ -236,10 +236,9 @@ class Curly
continue;
}
list($name, $value) = explode(':', $line);
$name = trim($name);
list($name, $value) = explode(':', $line, 2);
$normalizedName = strtolower($name);
$value = trim($value);
$value = trim($value, "\t ");
if (!array_key_exists($normalizedName, $headerMap))
{
......
<?php
/**
* Copyright (c) 2015 Bernardo van der Wal
* MIT License
*
* Refer to the LICENSE file for the full copyright notice.
*/
namespace OneOfZero\Curly\Tests;
use OneOfZero\Curly\Curly;
class BugDrivenTest extends AbstractTestCase
{
public function testColonsInHeaderValue()
{
$curly = new Curly();
$encodedHeader = urlencode('X-Test') . '=' . urlencode('https://example.com');
$request = $this->buildRequest('GET', 'response-headers?' . $encodedHeader);
$response = $curly->request($request);
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('https://example.com', $response->getHeaderLine('X-Test'));
}
}
\ No newline at end of file
......@@ -11,8 +11,6 @@ namespace OneOfZero\Curly\Tests;
use OneOfZero\Curly\Curly;
use OneOfZero\Curly\ExtendedServerRequest;
use OneOfZero\Curly\RequestHelpers\JsonForm;
use OneOfZero\Curly\RequestHelpers\UrlEncodedForm;
use Zend\Diactoros\Request;
class GenericTest extends AbstractTestCase
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment