Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cdf639b

Browse files
committed
minor #16949 [BrowserKit] Add response management to BrowserKit documentation (without toArray) (alexandre-daubois)
This PR was merged into the 4.4 branch. Discussion ---------- [BrowserKit] Add response management to BrowserKit documentation (without toArray) Closes #16580 for 4.4 (without `toArray()`) Commits ------- 67b08ad [BrowserKit] Add response fetch to BrowserKit documentation
2 parents 4cfd68b + 67b08ad commit cdf639b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

components/browser_kit.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,19 @@ dedicated web crawler or scraper such as `Goutte`_::
327327

328328
The feature to make external HTTP requests was introduced in Symfony 4.3.
329329

330+
Dealing with HTTP responses
331+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
332+
333+
When using the BrowserKit component, you may need to deal with responses of
334+
the requests you made. To do so, you need to call the ``getResponse()``
335+
method of the ``HttpBrowser`` object. This method retrieves the last response
336+
the browser received::
337+
338+
$browser = new HttpBrowser(HttpClient::create());
339+
340+
$browser->request('GET', 'https://foo.com');
341+
$response = $browser->getResponse();
342+
330343
Learn more
331344
----------
332345

0 commit comments

Comments
 (0)