@@ -740,7 +740,7 @@ Retry Over Several Base URIs
740740
741741The ``RetryableHttpClient `` can be configured to use multiple base URIs. This
742742feature provides increased flexibility and reliability for making HTTP
743- requests. Pass an array of base URIs as option ``base_uri `` when making a
743+ requests. Pass an array of base URIs as option ``base_uri `` when making a
744744request::
745745
746746 $response = $client->request('GET', 'some-page', [
@@ -752,7 +752,7 @@ request::
752752 ],
753753 ]);
754754
755- When the number of retries is higher than the number of base URIs, the
755+ When the number of retries is higher than the number of base URIs, the
756756last base URI will be used for the remaining retries.
757757
758758If you want to shuffle the order of base URIs for each retry attempt, nest the
@@ -770,13 +770,13 @@ base URIs you want to shuffle in an additional array::
770770 ],
771771 ]);
772772
773- This feature allows for a more randomized approach to handling retries,
773+ This feature allows for a more randomized approach to handling retries,
774774reducing the likelihood of repeatedly hitting the same failed base URI.
775775
776- By using a nested array for the base URI, you can use this feature
776+ By using a nested array for the base URI, you can use this feature
777777to distribute the load among many nodes in a cluster of servers.
778778
779- You can also configure the array of base URIs using the ``withOptions() ``
779+ You can also configure the array of base URIs using the ``withOptions() ``
780780method::
781781
782782 $client = $client->withOptions(['base_uri' => [
@@ -2032,6 +2032,30 @@ Then configure Symfony to use your callback:
20322032 ;
20332033 };
20342034
2035+ To return json, you would normally do::
2036+
2037+ use Symfony\Component\HttpClient\Response\MockResponse;
2038+
2039+ $response = new MockResponse(json_encode([
2040+ 'foo' => 'bar',
2041+ ]), [
2042+ 'response_headers' => [
2043+ 'content-type' => 'application/json',
2044+ ],
2045+ ]);
2046+
2047+ You can use :class: `Symfony\\ Component\\ HttpClient\\ Response\\ JsonMockResponse ` instead::
2048+
2049+ use Symfony\Component\HttpClient\Response\JsonMockResponse;
2050+
2051+ $response = new JsonMockResponse([
2052+ 'foo' => 'bar',
2053+ ]);
2054+
2055+ .. versionadded :: 6.3
2056+
2057+ The ``JsonMockResponse `` was introduced in Symfony 6.3.
2058+
20352059Testing Request Data
20362060~~~~~~~~~~~~~~~~~~~~
20372061
0 commit comments