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

No class method to set timeout #36

Closed
taazza opened this issue Apr 11, 2010 · 2 comments
Closed

No class method to set timeout #36

taazza opened this issue Apr 11, 2010 · 2 comments

Comments

@taazza
Copy link

taazza commented Apr 11, 2010

In lib/httparty.rb, there is no class method to specify a default timeout value for all calls. In lib/httparty/request.rb, the private method http looks for the :timeout key in options for setting http read timeout. Hence, using default_params class method for specifying default timeout does not work.

Currently, after including HTTParty in the class, we use

self.class.default_options[:timeout] = <some timeout value>

to set timeouts. But this seems more like a hack, as we are using instance variables defined by HTTParty. Is there a cleaner/better way out which we are missing?

@sandro
Copy link
Collaborator

sandro commented Apr 12, 2010

When the timeout option was added, the only use case I had in mind was on a per-request basis. Adding a global timeout option is a good idea, I'll accept the relevant patch.

@taazza
Copy link
Author

taazza commented Apr 12, 2010

I have sent a pull request for taazza/httparty@07806de

ntalbott pushed a commit to ntalbott/httparty that referenced this issue May 4, 2012
This issue was closed.
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

No branches or pull requests

2 participants