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

Drop support for typhoeus 0.4 #905

Merged
merged 3 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions lib/vcr/library_hooks/typhoeus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def vcr_request
@vcr_request ||= VCR::Request.new \
request.options.fetch(:method, :get),
request.url,
request_body,
request.encoded_body,
request.options.fetch(:headers, {})
end

Expand Down Expand Up @@ -63,16 +63,6 @@ def stubbed_response_headers
end if stubbed_response.headers
end
end

if ::Typhoeus::Request.method_defined?(:encoded_body)
def request_body
request.encoded_body
end
else
def request_body
request.options.fetch(:body, "")
end
end
end

# @private
Expand Down
16 changes: 4 additions & 12 deletions spec/monkey_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,10 @@ def disable_all!
end
end

if defined?(::Typhoeus.before)
olleolleolle marked this conversation as resolved.
Show resolved Hide resolved
require 'vcr/library_hooks/typhoeus'
$typhoeus_after_loaded_hook = VCR.configuration.hooks[:after_library_hooks_loaded].last
$original_typhoeus_global_hooks = Typhoeus.on_complete.dup
$original_typhoeus_before_hooks = Typhoeus.before.dup
elsif defined?(::Typhoeus::Hydra.global_hooks)
# require 'vcr/library_hooks/typhoeus'
# $typhoeus_0_4_after_loaded_hook = VCR.configuration.hooks[:after_library_hooks_loaded].first
# $typhoeus_after_loaded_hook = VCR.configuration.hooks[:after_library_hooks_loaded].last
# $original_typhoeus_global_hooks = Typhoeus::Hydra.global_hooks.dup
# $original_typhoeus_stub_finders = Typhoeus::Hydra.stub_finders.dup
end
require 'vcr/library_hooks/typhoeus'
$typhoeus_after_loaded_hook = VCR.configuration.hooks[:after_library_hooks_loaded].last
$original_typhoeus_global_hooks = Typhoeus.on_complete.dup
$original_typhoeus_before_hooks = Typhoeus.before.dup

require 'vcr/library_hooks/webmock'
$original_webmock_callbacks = ::WebMock::CallbackRegistry.callbacks
Expand Down