Skip to content

Commit 01e1d4a

Browse files
committed
[HttpClient] Add JsonMockResponse
1 parent b6bf68e commit 01e1d4a

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
@@ -2032,6 +2032,19 @@ Then configure Symfony to use your callback:
20322032
;
20332033
};
20342034
2035+
You can also use :class:`Symfony\\Component\\HttpClient\\Response\\JsonMockResponse` which automatically encode
2036+
and set `application/json` header::
2037+
2038+
use Symfony\Component\HttpClient\Response\JsonMockResponse;
2039+
2040+
$response = new JsonMockResponse([
2041+
'foo' => 'bar',
2042+
]);
2043+
2044+
.. versionadded:: 6.3
2045+
2046+
The ``JsonMockResponse`` was introduced in Symfony 6.3.
2047+
20352048
Testing Request Data
20362049
~~~~~~~~~~~~~~~~~~~~
20372050

0 commit comments

Comments
 (0)