Skip to content

Commit 4d0b8bb

Browse files
committed
[HttpClient] HttpClientInterface::setResponseFactory method
1 parent 14d05b1 commit 4d0b8bb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

http_client.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,6 +1710,19 @@ However, using ``MockResponse`` allows simulating chunked responses and timeouts
17101710

17111711
The feature explained below was introduced in Symfony 5.2.
17121712

1713+
Also you can use setter method for all kinds of responses described above::
1714+
1715+
$responses = [
1716+
new MockResponse($body1, $info1),
1717+
new MockResponse($body2, $info2),
1718+
];
1719+
1720+
$client->setResponseFactory($responses);
1721+
1722+
.. versionadded:: 5.4
1723+
1724+
The setResponseFactory() method was introduced in Symfony 5.4.
1725+
17131726
Finally, you can also create an invokable or iterable class that generates the
17141727
responses and use it as a callback in functional tests::
17151728

0 commit comments

Comments
 (0)