File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -32,4 +32,17 @@ function it_reads_headers_from_string(ResponseInterface $response)
32
32
$ this ->beConstructedWith ($ response );
33
33
$ this ->setHeadersFromString ("HTTP/1.1 200 OK \r\nContent-type: text/html \r\n" );
34
34
}
35
+
36
+ /**
37
+ * @link https://github.com/php-http/message/issues/41
38
+ */
39
+ function it_not_broke_headers (ResponseInterface $ response )
40
+ {
41
+ $ response ->withStatus (200 , 'OK ' )->willReturn ($ response );
42
+ $ response ->withProtocolVersion ('1.1 ' )->willReturn ($ response );
43
+ $ response ->hasHeader ('Content-type ' )->willReturn (false );
44
+ $ response ->withHeader ('Content-type ' , 'application/xml+atom ' )->willReturn ($ response );
45
+ $ this ->beConstructedWith ($ response );
46
+ $ this ->setHeadersFromString ("HTTP/1.1 200 OK \r\nContent-type: application/xml+atom \r\n" );
47
+ }
35
48
}
Original file line number Diff line number Diff line change @@ -135,8 +135,8 @@ public function addHeader($headerLine)
135
135
sprintf ('"%s" is not a valid HTTP header line ' , $ headerLine )
136
136
);
137
137
}
138
- $ name = trim (urldecode ( $ parts [0 ]) );
139
- $ value = trim (urldecode ( $ parts [1 ]) );
138
+ $ name = trim ($ parts [0 ]);
139
+ $ value = trim ($ parts [1 ]);
140
140
if ($ this ->response ->hasHeader ($ name )) {
141
141
$ this ->response = $ this ->response ->withAddedHeader ($ name , $ value );
142
142
} else {
You can’t perform that action at this time.
0 commit comments