Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

response body is empty when recording an excon request using the webmock adapter #245

Closed
restebanez opened this Issue · 9 comments

3 participants

@restebanez

Hi,

VCR doesn't record at all the response body of an excon request using the webmock adapter, however they are recorded/replayed fine using the excon adapter.

When the requests is recorded, not error message shows up, the symptom shows up when replayed:

      Extra content at the end of the document (Nokogiri::XML::SyntaxError)
      (eval):6:in `block in request'
      (eval):5:in `request'

I've tried different gem versions but it consistently fails in all these cases:

vcr 2.3.0, excon (0.16.10) fog (1.5.0) excon (~> 0.14),  webmock (1.8.10) webmock (~> 1.8.0)
vcr 2.3.0, excon (0.14), fog (1.7.0), webmock (1.9.0) 
vcr 2.3.0, excon (0.14),excon (0.16.10),, fog (1.5.0), webmock (1.9.0)
vcr 2.3.0, excon (0.14),excon (0.16.10),, fog (1.5.0), webmock (1.8.0) 
vcr 2.2.5, excon (0.14),excon (0.16.10),, fog (1.5.0), webmock (1.8.0) 
vcr 2.2.0, excon (0.14),excon (0.16.10),, fog (1.5.0), webmock (1.8.0)

I have a cucumber scenario where multiple adapters are used (excon and wherever http library rest-client uses), so i can't just change the adapter to excon.

Thanks,

Rodrigo Estebanez

@myronmarston
Owner

VCR doesn't record at all the response body of an excon request using the webmock adapter, however they are recorded/replayed fine using the excon adapter.

VCR has tests that record the response body of an excon request using webmock, and those pass, so there must be something different about how you're making the requests. Any chance you could come up with a failing spec and/or a reproducible example?

I have a cucumber scenario where multiple adapters are used (excon and wherever http library rest-client uses), so i can't just change the adapter to excon.

hook_into can hook into multiple libraries:

VCR.configure do |vcr|
  vcr.hook_into :webmock, :excon, :typhoeus, :faraday
end

If you use :excon and :webmock, VCR will disable WebMock's excon adapter so that things work OK.

@restebanez

Using both adapters excon and :webmockmakes my cucumber scenario to pass just fine.

I'll try to come up with a reproducible example either later today or on Monday.

thanks a lot!

@restebanez

This cucumber tests proves that fog requestes are recorded empty when the webmock adapter is used:
restebanez@e077635

The test pass b/c i'm testing that the response body is empty (i couldn't find the "should not" step to make it fail)

b/w the Scenario assumes you have two ENV variables with your AWS credentials: AWS_BLUE_ACCESS_KEY_ID and AWS_BLUE_SECRET_ACCESS_KEY_ID

Thanks

@myronmarston
Owner

Thanks, that's a very clear example. I'll try to track down the source of the bug.

@myronmarston myronmarston referenced this issue from a commit
@myronmarston myronmarston Add a pending spec for #245.
It's a bug in webmock (bblimke/webmock#246). This
spec will help prevent future regressions.

Closes #245.
ffaad77
@myronmarston myronmarston closed this issue from a commit
@myronmarston myronmarston Add a pending spec for #245.
It's a bug in webmock (bblimke/webmock#246). This
spec will help prevent future regressions.

Closes #245.
ffaad77
@myronmarston

@restebanez -- It's a bug in WebMock. See bblimke/webmock#246 for the full details. I've added a pending spec to VCR so that it can help prevent a future regression once it's fixed in WebMock, but that's the best I can do.

@jayshepherd

I've confirmed this with a slight tweak to the expected output with the empty body response block:

    Then the file "cassettes/fog-using-excon.yml" should contain:
      """
          body:
            encoding: US-ASCII
            string: ''
      """
@jayshepherd

Ack! You were already looking into it while I was! :) Glad you found something more concrete as it took me a little while to reproduce.

@restebanez

Thanks a lot @myronmarston !

@myronmarston

@jayshepherd -- thanks for taking a stab at this. VCR could really use some additional people who help troubleshoot issues, fix bugs, etc. #254 is a similar issue (probably a bug in WebMock)--want to take a stab at that one?

@plukevdh plukevdh referenced this issue from a commit in plukevdh/vcr
@myronmarston myronmarston Add a pending spec for #245.
It's a bug in webmock (bblimke/webmock#246). This
spec will help prevent future regressions.

Closes #245.
e7e021d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.