diff --git a/tests/ZendTest/Http/HeadersTest.php b/tests/ZendTest/Http/HeadersTest.php index a2cefc6c435..875d3e2980f 100644 --- a/tests/ZendTest/Http/HeadersTest.php +++ b/tests/ZendTest/Http/HeadersTest.php @@ -57,7 +57,8 @@ public function testHeadersFromStringFactoryCreatesSingleObjectWithContinuationL $header = $headers->get('fake'); $this->assertInstanceOf('Zend\Http\Header\GenericHeader', $header); $this->assertEquals('Fake', $header->getFieldName()); - $this->assertEquals('foo-bar,blah-blah', $header->getFieldValue()); + // any leading space MAY be replaced by a single space @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html + $this->assertEquals('foo-bar, blah-blah', $header->getFieldValue()); } public function testHeadersFromStringFactoryCreatesSingleObjectWithContinuationLineAndLeadingWhitespaces() @@ -68,7 +69,8 @@ public function testHeadersFromStringFactoryCreatesSingleObjectWithContinuationL $header = $headers->get('fake'); $this->assertInstanceOf('Zend\Http\Header\GenericHeader', $header); $this->assertEquals('Fake', $header->getFieldName()); - $this->assertEquals('foo-bar,blah-blah', $header->getFieldValue()); + // any leading space MAY be replaced by a single space @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html + $this->assertEquals('foo-bar, blah-blah', $header->getFieldValue()); } public function testHeadersFromStringFactoryCreatesSingleObjectWithHeaderBreakLine() @@ -93,6 +95,17 @@ public function testHeadersFromStringFactoryCreatesSingleObjectWithHeaderBreakLi $this->assertEquals('foo-bar', $header->getFieldValue()); } + public function testHeadersFromStringFactoryRespectsSpecAllowedMultiLineHeaders() + { + $headers = Headers::fromString("Foo: foo-bar\r\nX-Another: another\r\n X-Actually-A-Continuation:ofSomeKindOfValue\r\nX-Another: another\r\n"); + $this->assertEquals(3, $headers->count()); + + // check continued header + $header = $headers->get('X-Another'); + $this->assertEquals('X-Another', $header->getFieldName()); + $this->assertEquals('another X-Actually-A-Continuation:ofSomeKindOfValue', $header->getFieldValue()); + } + public function testHeadersFromStringFactoryThrowsExceptionOnMalformedHeaderLine() { $this->setExpectedException('Zend\Http\Exception\RuntimeException', 'does not match');