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

Wrong number of arguments with http 2.2.0 and webmock #395

Closed
javierjulio opened this issue Feb 4, 2017 · 4 comments
Closed

Wrong number of arguments with http 2.2.0 and webmock #395

javierjulio opened this issue Feb 4, 2017 · 4 comments
Assignees

Comments

@javierjulio
Copy link

javierjulio commented Feb 4, 2017

I had just been updating some outdated dependencies in a project. I reviewed the changes for http but didn't expect anything breaking. I had some tests fail where we use webmock. The two are involved but I'm not sure what is wrong.

ArgumentError:         ArgumentError: wrong number of arguments (given 1, expected 2..3)
            /Users/javierjulio/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/http-2.2.0/lib/http/response/body.rb:18:in `initialize'
            /Users/javierjulio/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/response.rb:17:in `new'
            /Users/javierjulio/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/response.rb:17:in `from_webmock'
            /Users/javierjulio/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/webmock.rb:41:in `replay'
            /Users/javierjulio/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/webmock.rb:10:in `exec'
            /Users/javierjulio/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/client.rb:7:in `perform'
            /Users/javierjulio/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/http-2.2.0/lib/http/client.rb:41:in `request'
            /Users/javierjulio/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/http-2.2.0/lib/http/chainable.rb:26:in `post'
@britishtea
Copy link
Contributor

Looks like with version 2.2.0, specifically commit 9542da4, the signature of Response::Body#initialize changed. This is the webmock callsite.

Since Response::Body isn't marked as private API, this should probably be considered breaking backwards compatibility?

Meanwhile locking the http gem to "~> 2.1.0" should work (until either WebMock does so or a bug fix is released).

@tarcieri
Copy link
Member

tarcieri commented Feb 4, 2017

Sounds like a regression. We should release a patched version that supports the old API.

@javierjulio
Copy link
Author

Sorry I should have replied back as I was attempting to resolve the issue. Yes @britishtea is right, locking the version to 2.1.0 works. That's what my project was using before upgrading so its fine for us for now.

@ixti ixti self-assigned this Feb 6, 2017
@ixti
Copy link
Member

ixti commented Feb 6, 2017

Will release http 2.2.1 with fix today

ixti added a commit that referenced this issue Feb 6, 2017
@ixti ixti closed this as completed in #396 Feb 6, 2017
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Mar 20, 2017
## 2.2.1 (2017-02-06)

* [#395](httprb/http#395)
  Fix regression of API, that broke webmock integration.
  ([@ixti])
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

No branches or pull requests

4 participants