Skip to content

Allow usage of typhoeus >= 1.2 #1023

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

Merged
merged 2 commits into from
Jul 21, 2024
Merged

Conversation

andrehjr
Copy link
Contributor

@andrehjr andrehjr commented Jul 21, 2024

After typhoeus 1.3 the response classes changed from inhering Hash directly. https://github.com/typhoeus/typhoeus/pull/575/files

But changing the specs from include to hash_including fixed the issue.

Without this fix, on typhoeus 1.4.1.

I've also added c3734f2 which fixes #1022

  1) Typhoeus hook when using on_headers callback is expected to have attributes {:headers => (include {"Content-Length" => "18"})}
     Failure/Error: it { expect(on_headers).to have_attributes(headers: include("Content-Length" => "18")) }

       expected #<Typhoeus::Response:0x0000000109236f40 @options={:httpauth_avail => 0, :total_time => 0.001393, :starttr..., 21 Jul 2024 00:26:52 GMT", "Connection" => "Keep-Alive"}, @http_version="1.1", @handled_response=[]> to have attributes {:headers => (include {"Content-Length" => "18"})} but had attributes {:headers => #<Typhoeus::Response::Header({"Connection" => "Keep-Alive", "Content-Length" => "18", "Content...f-8", "Date" => "Sun, 21 Jul 2024 00:26:52 GMT", "Server" => "WEBrick/1.8.1 (Ruby/3.4.0/2024-03-18)"})>}
       Diff:
       @@ -1 +1 @@
       -:headers => (include {"Content-Length" => "18"}),
       +:headers => #<Typhoeus::Response::Header({"Connection"=>"Keep-Alive", "Content-Length"=>"18", "Content-Type"=>"text/html;charset=utf-8", "Date"=>"Sun, 21 Jul 2024 00:26:52 GMT", "Server"=>"WEBrick/1.8.1 (Ruby/3.4.0/2024-03-18)"})>,

     # ./spec/lib/vcr/library_hooks/typhoeus_spec.rb:127:in 'block (3 levels) in <top (required)>'

  2) Typhoeus hook when using on_headers callback is expected to yield with args(have attributes {:headers => (include {"Content-Length" => "18"})})
     Failure/Error: it { expect { |b| on_headers(&b) }.to yield_with_args(have_attributes(headers: include('Content-Length' => '18'))) }

       expected given block to yield with arguments, but yielded with unexpected arguments
       expected: [(have attributes {:headers => (include {"Content-Length" => "18"})})]
            got: [#<Typhoeus::Response:0x00000001091dc540 @options={:httpauth_avail=>0, :total_time=>0.001191, :startt...\r\n", :response_body=>"", :debug_info=>#<Ethon::Easy::DebugInfo:0x000000010870a9f0 @messages=[]>}>]
     # ./spec/lib/vcr/library_hooks/typhoeus_spec.rb:124:in 'block (3 levels) in <top (required)>'
     ```

@andrehjr andrehjr marked this pull request as ready for review July 21, 2024 01:03
Copy link
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @andrehjr! This unblocks us!

@olleolleolle olleolleolle merged commit 95a9192 into vcr:master Jul 21, 2024
9 checks passed
@andrehjr andrehjr deleted the update-typhoeus branch July 21, 2024 13:46
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

Successfully merging this pull request may close these issues.

typhoeus test fails
2 participants