Skip to content

Commit e080852

Browse files
committed
Minor reword
1 parent 638a96e commit e080852

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

http_client.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,11 +2196,15 @@ test it in a real application::
21962196
}
21972197
}
21982198

2199-
Testing using HAR files
2199+
Testing Using HAR Files
22002200
~~~~~~~~~~~~~~~~~~~~~~~
22012201

2202-
The previous example can also be achieved using `HAR`_ files. You can export those files from all modern browsers (from the network tab) &
2203-
HTTP Clients. First, do the HTTP request(s) you want to test in your favorite HTTP Client / Browser, then store generated ``.har`` file somewhere in your application::
2202+
Modern browsers (via their network tab) and HTTP clients allow to export the
2203+
information of one or more HTTP requests using the `HAR`_ (HTTP Archive) format.
2204+
You can use those ``.har`` files to perform tests with Symfony's HTTP Client.
2205+
2206+
First, use a browser or HTTP client to perform the HTTP request(s) you want to
2207+
test. Then, save that information as a ``.har`` file somewhere in your application::
22042208

22052209
// ExternalArticleServiceTest.php
22062210
use PHPUnit\Framework\TestCase;
@@ -2225,11 +2229,11 @@ HTTP Clients. First, do the HTTP request(s) you want to test in your favorite HT
22252229
}
22262230
}
22272231

2228-
2229-
If your service does multiple requests or if your `.har` file contains multiple request / response pairs,
2230-
the :class:`Symfony\\Component\\HttpClient\\Test\\HarFileResponseFactory` will find the associated response based on
2231-
the request method, url and body (if any). Note that **this doesn't work** if the request body or uri is random / always changing
2232-
(if it contains current date or random UUID(s) for example).
2232+
If your service performs multiple requests or if your ``.har`` file contains multiple
2233+
request/response pairs, the :class:`Symfony\\Component\\HttpClient\\Test\\HarFileResponseFactory`
2234+
will find the associated response based on the request method, URL and body (if any).
2235+
Note that **this won't work** if the request body or URI is random / always
2236+
changing (e.g. if it contains current date or random UUIDs).
22332237

22342238
.. versionadded:: 6.4
22352239

0 commit comments

Comments
 (0)