Skip to content
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

Added possibility to limit the amount of data retrieved #148

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

daigo75
Copy link

@daigo75 daigo75 commented Sep 17, 2014

Ref. feature request #137.

Usage example

$Response = \Httpful\Request::get('http://somesite.com')
    ->limit(1000) // Limit the amount of bytes retrieved
    ->send();

@daigo75
Copy link
Author

daigo75 commented Sep 17, 2014

Note: the coding style used for the library is different from the one I normally use, therefore you might need to make a couple of adjustments.

* Pevious logic was not taking into account the case in which the limit was high enough for the Request to retrieve the whole page. When this is the case, the $result variable contains "true" (boolean), and the actual content must be retrieved from Request::retrieved_data property.
@nategood
Copy link
Owner

Hi @daigo75. Please convert the spacing in here to spaces as opposed to hard tabs for consistency. Thanks!

@daigo75
Copy link
Author

daigo75 commented Oct 21, 2014

I forgot, my editor is set to tabs (never liked spaces much, too rigid). I will review the files and make the conversion.

By the way, technically, spaces are hard indentation, while tabs are a soft one (two spaces are always two spaces, while tabs can be displayed as 1, 2, 3 or more). :)

@daigo75
Copy link
Author

daigo75 commented Oct 21, 2014

Done! Tabs are now spaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants