Skip to content

Conversation

@bryangruneberg
Copy link

For my project I needed the crawler to follow redirects.

With this change I can initialise the crawler as follows

Crawler::create([RequestOptions::ALLOW_REDIRECTS => true]) ->setCrawlObserver($kriechenCrawler) ->setCrawlProfile($kriechenCrawler) ->startCrawling($url);

@freekmurze
Copy link
Member

Thank you for your contribution.

I'm not a fan of passing the option to the create method. Could please replace this by a fluent setter? Also add a test to prove that the change works.

@bryangruneberg
Copy link
Author

Hey there,

Sure happy to do that.

I'll revert the changes to the constructor, and add a fluent setter that sets a request options array. Then I'll alter the $client->request() call to use the options. I think that is a cleaner way of going about it.

In terms of the test, would you like to specifically test the "allow_redirects" flag, or to test the fact that the guzzle client request() call accepts the parameters?

Thanks!

@danhunsaker
Copy link

Generally, you only want to test your own library, not the dependencies. So the Guzzle client should be mocked out anyway.

@freekmurze
Copy link
Member

I've added support for this in v2 of the package, which will be released rather soonish.

@freekmurze freekmurze closed this Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants