@@ -162,7 +162,7 @@ requests and the specific headers for each request::
162162 // of the same header if defined globally by the HTTP client
163163 $response = $httpClient->request('POST', 'https://...', [
164164 'headers' => [
165- 'Content-type ' => 'text/plain',
165+ 'Content-Type ' => 'text/plain',
166166 ],
167167 ]);
168168
@@ -190,7 +190,8 @@ processed automatically when making the requests::
190190 ]);
191191
192192When uploading data with the ``POST `` method, if you don't define the
193- ``Content-Type `` HTTP header explicitly, Symfony adds the required
193+ ``Content-Type `` HTTP header explicitly, Symfony assumes that you're uploading
194+ form data and adds the required
194195``'Content-Type: application/x-www-form-urlencoded' `` header for you.
195196
196197When uploading JSON payloads, use the ``json `` option instead of ``body ``. The
@@ -270,7 +271,7 @@ response sequentially instead of waiting for the entire response::
270271 // optional: if you don't want to buffer the response in memory
271272 'buffer' => false,
272273 // optional: to display details about the response progress
273- 'on_progress' => function (int $dlNow, int $dlSize, array $info) {
274+ 'on_progress' => function (int $dlNow, int $dlSize, array $info): void {
274275 // ...
275276 },
276277 ]);
@@ -290,10 +291,11 @@ response sequentially instead of waiting for the entire response::
290291Handling Exceptions
291292~~~~~~~~~~~~~~~~~~~
292293
293- Whenan HTTPerror happens ( status code3xx, 4xx or 5xx) your code is expected
294- to handle it by checking the status code of the response . If you don't do that,
295- the ``getHeaders() `` and ``getContent() `` methods throw an appropriate exception::
294+ Whenthe HTTP status codeof the response is not in the 200-299 range (i.e. 3xx,
295+ 4xx or 5xx) your code is expected to handle it . If you don't do that, the
296+ ``getHeaders() `` and ``getContent() `` methods throw an appropriate exception::
296297
298+ // the response of this request will be a 403 HTTP error
297299 $response = $httpClient->request('GET', 'https://httpbin.org/status/403');
298300
299301 // this code results in a Symfony\Component\HttpClient\Exception\ClientException
@@ -506,15 +508,15 @@ responses dynamically when it's called::
506508 use Symfony\Component\HttpClient\Response\MockResponse;
507509
508510 $callback = function ($method, $url, $options) {
509- return new MockResponse('...';
511+ return new MockResponse('...') ;
510512 };
511513
512514 $client = new MockHttpClient($callback);
513515 $response = $client->request('...'); // calls $callback to get the response
514516
515517The responses provided to the mock client don't have to be instances of
516518``MockResponse ``. Any class implementing ``ResponseInterface `` will work (e.g.
517- ``$this->getMockBuilder (ResponseInterface::class)->getMock( ) ``).
519+ ``$this->createMock (ResponseInterface::class) ``).
518520
519521However, using ``MockResponse `` allows simulating chunked responses and timeouts::
520522