This repository was archived by the owner on Jan 30, 2020. It is now read-only.
File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -1184,7 +1184,7 @@ protected function prepareHeaders($body, $uri)
1184
1184
// Set the Accept-encoding header if not set - depending on whether
1185
1185
// zlib is available or not.
1186
1186
if (! $ this ->getRequest ()->getHeaders ()->has ('Accept-Encoding ' )) {
1187
- if (function_exists ('gzinflate ' )) {
1187
+ if (empty ( $ this -> config [ ' outputstream ' ]) && function_exists ('gzinflate ' )) {
1188
1188
$ headers ['Accept-Encoding ' ] = 'gzip, deflate ' ;
1189
1189
} else {
1190
1190
$ headers ['Accept-Encoding ' ] = 'identity ' ;
Original file line number Diff line number Diff line change 12
12
use ReflectionMethod ;
13
13
use Zend \Http \Client ;
14
14
use Zend \Http \Client \Adapter \AdapterInterface ;
15
+ use Zend \Http \Client \Adapter \Curl ;
16
+ use Zend \Http \Client \Adapter \Proxy ;
17
+ use Zend \Http \Client \Adapter \Socket ;
15
18
use Zend \Http \Client \Adapter \Test ;
16
19
use Zend \Http \Client \Exception as ClientException ;
17
20
use Zend \Http \Cookies ;
@@ -607,4 +610,31 @@ public function testSetCookieAcceptOnlyArray()
607
610
$ this ->expectExceptionMessage ('Invalid cookies passed as parameter, it must be an array ' );
608
611
$ client ->setCookies (new SetCookie ('name ' , 'value ' ));
609
612
}
613
+
614
+ /**
615
+ * @return AdapterInterface[]
616
+ */
617
+ public function adapterWithStreamSupport ()
618
+ {
619
+ yield 'curl ' => [new Curl ()];
620
+ yield 'proxy ' => [new Proxy ()];
621
+ yield 'socket ' => [new Socket ()];
622
+ }
623
+
624
+ /**
625
+ * @dataProvider adapterWithStreamSupport
626
+ */
627
+ public function testStreamCompression (AdapterInterface $ adapter )
628
+ {
629
+ $ tmpFile = tempnam (sys_get_temp_dir (), 'stream ' );
630
+
631
+ $ client = new Client ('https://www.gnu.org/licenses/gpl-3.0.txt ' );
632
+ $ client ->setAdapter ($ adapter );
633
+ $ client ->setStream ($ tmpFile );
634
+ $ client ->send ();
635
+
636
+ $ response = $ client ->getResponse ();
637
+
638
+ self ::assertSame ($ response ->getBody (), file_get_contents ($ tmpFile ));
639
+ }
610
640
}
You can’t perform that action at this time.
0 commit comments