lib/hyper_resource/modules/http.rb in aptible-resource-1.1.1 vs lib/hyper_resource/modules/http.rb in aptible-resource-1.1.2
- old
+ new
@@ -21,11 +21,10 @@
def initialize_http_client!
@http_client = HTTPClient.new.tap do |c|
c.cookie_manager = nil
c.connect_timeout = 30
c.send_timeout = 45
- c.receive_timeout = 30
c.keep_alive_timeout = 15
c.ssl_config.set_default_paths
end
end
end
@@ -33,9 +32,14 @@
# We use this accessor / initialize as opposed to a simple constant
# because during specs, Webmock stubs the HTTPClient class, but that's
# happens after we initialized the constant (we could work around that
# by loading Webmock first, but this is just as simple.
initialize_http_client!
+
+ # Allow the application to configure the timeout
+ def configure_client
+ HTTP.http_client.receive_timeout = Aptible::Resource.configuration.timeout
+ end
## Loads and returns the resource pointed to by +href+. The returned
## resource will be blessed into its "proper" class, if
## +self.class.namespace != nil+.
def get