lib/httpx/adapters/faraday.rb in httpx-0.17.0 vs lib/httpx/adapters/faraday.rb in httpx-0.18.0
- old
+ new
@@ -20,10 +20,12 @@
Faraday::Error::ConnectionFailed
end
# :nocov:
module RequestMixin
+ using ::HTTPX::HashExtensions
+
private
def build_request(env)
meth = env[:method]
@@ -36,11 +38,11 @@
def options_from_env(env)
timeout_options = {
connect_timeout: env.request.open_timeout,
operation_timeout: env.request.timeout,
- }.reject { |_, v| v.nil? }
+ }.compact
options = {
ssl: {},
timeout: timeout_options,
}
@@ -99,21 +101,21 @@
@env = env
super
end
def on_response(&blk)
- if block_given?
+ if blk
@on_response = lambda do |response|
blk.call(response)
end
self
else
@on_response
end
end
def on_complete(&blk)
- if block_given?
+ if blk
@on_complete = blk
self
else
@on_complete
end