Skip to content

[BrowserKit] Add response management to BrowserKit documentation (without toArray) #16949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions components/browser_kit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,19 @@ dedicated web crawler or scraper such as `Goutte`_::

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

Dealing with HTTP responses
~~~~~~~~~~~~~~~~~~~~~~~~~~~

When using the BrowserKit component, you may need to deal with responses of
the requests you made. To do so, you need to call the ``getResponse()``
method of the ``HttpBrowser`` object. This method retrieves the last response
the browser received::

$browser = new HttpBrowser(HttpClient::create());

$browser->request('GET', 'https://foo.com');
$response = $browser->getResponse();

Learn more
----------

Expand Down