Skip to content

Commit 7a0f16e

Browse files
committed
[HttpClient] Apply suggested rewording in review
1 parent 75f1653 commit 7a0f16e

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

http_client.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,18 +1391,20 @@ Testing
13911391
-------
13921392

13931393
This component includes the ``MockHttpClient`` and ``MockResponse`` classes to
1394-
use them in tests that shouldn't make actual HTTP requests. Such tests can be
1395-
useful, as they are faster and consistent due to not being dependant on
1396-
external service the request would be sent to. In result there is no need to
1397-
worry about the service being online or the request changing some state,
1398-
for example deleting a resource.
1394+
use in tests that shouldn't make actual HTTP requests. Such tests can be
1395+
useful, as they will run faster and produce consistent results, since they're
1396+
not dependant on an external service. By not making actual HTTP requests there
1397+
is no need to worry about the service being online or the request changing
1398+
state, for example deleting a resource.
13991399

14001400
``MockHttpClient`` implements the ``HttpClientInterface``, just like any actual
1401-
HTTP client in this component. You can use the interface to accept real client
1402-
in your code, while replacing it with ``MockHttpClient`` in the test.
1401+
HTTP client in this component. When you typehint with ``HttpClientInterface``
1402+
your code will accept the real client outside tests, while replacing it with
1403+
``MockHttpClient`` in the test.
14031404

14041405
When the ``request`` method is used on ``MockHttpClient``, it will respond with
1405-
supplied ``MockResponse``. There are few ways to use it, as described below.
1406+
the supplied ``MockResponse``. There are a few ways to use it, as described
1407+
below.
14061408

14071409
HTTP Client and Responses
14081410
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1468,10 +1470,11 @@ Testing Request Data
14681470
~~~~~~~~~~~~~~~~~~~~
14691471

14701472
The examples above describe how to return desired response. What if you wanted
1471-
to also test the request itself? ``MockResponse`` comes with helper methods:
1473+
to also test the request itself? ``MockResponse`` comes with a few helper
1474+
methods:
14721475

1473-
* ``getRequestMethod()`` - returns HTTP method
1474-
* ``getRequestUrl()`` - returns URL the request would be sent to
1476+
* ``getRequestMethod()`` - returns the HTTP method
1477+
* ``getRequestUrl()`` - returns the URL the request would be sent to
14751478
* ``getRequestOptions()`` - returns an array containing other information about
14761479
the request such as headers, query parameters, body content etc.
14771480

@@ -1500,7 +1503,7 @@ Example
15001503
~~~~~~~
15011504

15021505
The following standalone example demonstrates a way to use HTTP client and
1503-
test it in real application::
1506+
test it in a real application::
15041507

15051508
// ExternalArticleService.php
15061509
use Symfony\Contracts\HttpClient\HttpClientInterface;

0 commit comments

Comments
 (0)