Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b559f80

Browse filesBrowse files
lubo13nicolas-grekas
authored andcommitted
[HttpClient] Add test case for seeking into the content of RetryableHttpClient responses
1 parent c1da0eb commit b559f80
Copy full SHA for b559f80

File tree

Expand file treeCollapse file tree

1 file changed

+18
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-0
lines changed

‎src/Symfony/Component/HttpClient/Tests/RetryableHttpClientTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/Tests/RetryableHttpClientTest.php
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,22 @@ public function log($level, $message, array $context = []): void
225225
$this->assertNotNull($delay);
226226
$this->assertSame((int) ($retryAfter * 1000), $delay);
227227
}
228+
229+
public function testRetryOnErrorAssertContent()
230+
{
231+
$client = new RetryableHttpClient(
232+
new MockHttpClient([
233+
new MockResponse('', ['http_code' => 500]),
234+
new MockResponse('Test out content', ['http_code' => 200]),
235+
]),
236+
new GenericRetryStrategy([500], 0),
237+
1
238+
);
239+
240+
$response = $client->request('GET', 'http://example.com/foo-bar');
241+
242+
self::assertSame(200, $response->getStatusCode());
243+
self::assertSame('Test out content', $response->getContent());
244+
self::assertSame('Test out content', $response->getContent(), 'Content should be buffered');
245+
}
228246
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.