Skip to content

Commit

Permalink
[feature] Add Browser::content() to fetch the raw response body (#109)
Browse files Browse the repository at this point in the history
* Add content method to get the raw response content

Add helper method to easily obtain the raw content from the response

* Add new method to README
  • Loading branch information
benr77 committed Oct 27, 2022
1 parent d361b2a commit 51bb8b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -193,6 +193,8 @@ $browser
})

->crawler() // Symfony\Component\DomCrawler\Crawler instance for the current response

->content() // Obtain the raw content from the response object

// save the raw source of the current page
// by default, saves to "<project-root>/var/browser/source"
Expand Down
5 changes: 5 additions & 0 deletions src/Browser.php
Expand Up @@ -98,6 +98,11 @@ final public function crawler(): Crawler
{
return $this->client()->getCrawler();
}

final public function content(): string
{
return $this->client()->getResponse()->getContent();
}

/**
* @return static
Expand Down

0 comments on commit 51bb8b1

Please sign in to comment.