File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \HttpClient \Tests ;
13
13
14
14
use Symfony \Component \HttpClient \Exception \ClientException ;
15
+ use Symfony \Component \HttpClient \Exception \TransportException ;
15
16
use Symfony \Component \HttpClient \Response \StreamWrapper ;
16
17
use Symfony \Component \Process \Exception \ProcessFailedException ;
17
18
use Symfony \Component \Process \Process ;
@@ -104,6 +105,23 @@ public function testNonBlockingStream()
104
105
$ this ->assertTrue (feof ($ stream ));
105
106
}
106
107
108
+ public function testTimeoutIsNotAFatalError ()
109
+ {
110
+ $ client = $ this ->getHttpClient (__FUNCTION__ );
111
+ $ response = $ client ->request ('GET ' , 'http://localhost:8057/timeout-body ' , [
112
+ 'timeout ' => 0.1 ,
113
+ ]);
114
+
115
+ try {
116
+ $ response ->getContent ();
117
+ $ this ->fail (TransportException::class.' expected ' );
118
+ } catch (TransportException $ e ) {
119
+ }
120
+
121
+ usleep (400000 );
122
+ $ this ->assertSame ('<1><2> ' , $ response ->getContent ());
123
+ }
124
+
107
125
public function testResponseStreamRewind ()
108
126
{
109
127
$ client = $ this ->getHttpClient (__FUNCTION__ );
Original file line number Diff line number Diff line change @@ -253,6 +253,7 @@ protected function getHttpClient(string $testCase): HttpClientInterface
253
253
254
254
case 'testTimeoutOnStream ' :
255
255
case 'testUncheckedTimeoutThrows ' :
256
+ case 'testTimeoutIsNotAFatalError ' :
256
257
$ body = ['<1> ' , '' , '<2> ' ];
257
258
$ responses [] = new MockResponse ($ body , ['response_headers ' => $ headers ]);
258
259
break ;
You can’t perform that action at this time.
0 commit comments