File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 11# Change Log
22
3+ ## Unreleased
4+
5+ ### Fixed
6+
7+ - #41 : Response builder broke header value
8+
9+
310## 1.2.0 - 2016-03-29
411
512### Added
Original file line number Diff line number Diff line change @@ -23,13 +23,16 @@ function it_reads_headers_from_array(ResponseInterface $response)
2323 $ this ->setHeadersFromArray (['HTTP/1.1 200 OK ' , 'Content-type: text/html ' ]);
2424 }
2525
26- function it_reads_headers_from_string (ResponseInterface $ response )
26+ /**
27+ * @link https://github.com/php-http/message/issues/41
28+ */
29+ function it_splits_headers_correctly (ResponseInterface $ response )
2730 {
2831 $ response ->withStatus (200 , 'OK ' )->willReturn ($ response );
2932 $ response ->withProtocolVersion ('1.1 ' )->willReturn ($ response );
3033 $ response ->hasHeader ('Content-type ' )->willReturn (false );
31- $ response ->withHeader ('Content-type ' , 'text/html ' )->willReturn ($ response );
34+ $ response ->withHeader ('Content-type ' , 'application/xml+atom ' )->willReturn ($ response );
3235 $ this ->beConstructedWith ($ response );
33- $ this ->setHeadersFromString ("HTTP/1.1 200 OK \r\nContent-type: text/html \r\n" );
36+ $ this ->setHeadersFromString ("HTTP/1.1 200 OK \r\nContent-type: application/xml+atom \r\n" );
3437 }
3538}
Original file line number Diff line number Diff line change @@ -135,8 +135,8 @@ public function addHeader($headerLine)
135135 sprintf ('"%s" is not a valid HTTP header line ' , $ headerLine )
136136 );
137137 }
138- $ name = trim (urldecode ( $ parts [0 ]) );
139- $ value = trim (urldecode ( $ parts [1 ]) );
138+ $ name = trim ($ parts [0 ]);
139+ $ value = trim ($ parts [1 ]);
140140 if ($ this ->response ->hasHeader ($ name )) {
141141 $ this ->response = $ this ->response ->withAddedHeader ($ name , $ value );
142142 } else {
You can’t perform that action at this time.
0 commit comments