Skip to content

Commit 1f5fb49

Browse files
[BrowserKit] Add response fetch to BrowserKit documentation
1 parent fc7ee50 commit 1f5fb49

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
@@ -354,6 +354,19 @@ dedicated web crawler or scraper such as `Goutte`_::
354354
Dealing with HTTP responses
355355
~~~~~~~~~~~~~~~~~~~~~~~~~~~
356356

357+
When using the BrowserKit component, you may need to deal with responses of
358+
the requests you made. To do so, you need to call the ``getResponse()``
359+
method of the ``HttpBrowser`` object. This method retrieves the last response
360+
the browser received::
361+
362+
$browser = new HttpBrowser(HttpClient::create());
363+
364+
$browser->request('GET', 'https://foo.com');
365+
$response = $browser->getResponse();
366+
367+
Dealing with HTTP responses
368+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
369+
357370
When using the BrowserKit component, you may need to deal with responses of
358371
the requests you made. To do so, you need to call the ``getResponse()``
359372
method of the ``HttpBrowser`` object. This method retrieves the last response

0 commit comments

Comments
 (0)