lib/httpi.rb in httpi-3.0.1 vs lib/httpi.rb in httpi-3.0.2
- old
+ new
@@ -152,11 +152,12 @@
end
# Executes an HTTP request for the given +method+.
def request(method, request, adapter = nil, redirects = 0)
adapter_class = load_adapter(adapter, request)
-
+
+ Adapter.client_setup_block.call(adapter_class.client) if Adapter.client_setup_block
yield adapter_class.client if block_given?
log_request(method, request, Adapter.identify(adapter_class.class))
response = adapter_class.request(method)
@@ -170,9 +171,13 @@
end
# Shortcut for setting the default adapter to use.
def adapter=(adapter)
Adapter.use = adapter
+ end
+
+ def adapter_client_setup=(block)
+ Adapter.client_setup_block = block
end
private
def request_and_adapter_from(args)