Skip to content

Commit 6da4548

Browse files
committed
Minor tweaks
1 parent a149ca8 commit 6da4548

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

http_client.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ Testing
13931393
This component includes the ``MockHttpClient`` and ``MockResponse`` classes to
13941394
use in tests that shouldn't make actual HTTP requests. Such tests can be
13951395
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
1396+
not dependent on an external service. By not making actual HTTP requests there
13971397
is no need to worry about the service being online or the request changing
13981398
state, for example deleting a resource.
13991399

@@ -1469,12 +1469,10 @@ However, using ``MockResponse`` allows simulating chunked responses and timeouts
14691469
Testing Request Data
14701470
~~~~~~~~~~~~~~~~~~~~
14711471

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

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

@@ -1490,19 +1488,19 @@ Usage example::
14901488
],
14911489
]);
14921490

1493-
// returns "DELETE"
14941491
$mockResponse->getRequestMethod();
1492+
// returns "DELETE"
14951493

1496-
// returns "https://example.com/api/article/1337"
14971494
$mockResponse->getRequestUrl();
1495+
// returns "https://example.com/api/article/1337"
14981496

1499-
// returns ["Accept: */*", "Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l"]
15001497
$mockResponse->getRequestOptions()['headers'];
1498+
// returns ["Accept: */*", "Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l"]
15011499

1502-
Example
1503-
~~~~~~~
1500+
Full Example
1501+
~~~~~~~~~~~~
15041502

1505-
The following standalone example demonstrates a way to use HTTP client and
1503+
The following standalone example demonstrates a way to use the HTTP client and
15061504
test it in a real application::
15071505

15081506
// ExternalArticleService.php

0 commit comments

Comments
 (0)