You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just an FYI issue, not sure what the best solution is here. I think this is a bad interaction between WebMock and google-api-client.
I use VCR and WebMock underneath to record and replay all interactions with Google APIs in tests. Ever since upgrading from google-api-client 0.9.pre3 to 0.9.1 all of my integration tests would break with:
It turns out that JSON::ParserError is raised when given a blank string to decode. After digging in, sure enough all of my VCR cassette files had recorded responses with empty response body (even though Content-Length would still be correct).
I dug through your spec_helper and found the monkey-patch for WebMock to support chunked responses—I thought that was it, but it turns out that I didn't need that, I only needed to add:
With that in my spec_helper.rb, everything works again because my cassettes record full response bodies again.
I assume that this is a bad interaction between WebMock, VCR, and google-api-client, but I haven't narrowed it to the smallest case yet (and probably won't now that I have a fix). For reference, here are a few of my related config settings:
I run this in my RSpec.configure block in spec_helper:
WebMock.disable_net_connect!
And my VCR setup is (slightly trimmed):
VCR.configuredo |c|
c.configure_rspec_metadata!c.cassette_library_dir='spec/cassettes'c.hook_into:webmockc.ignore_localhost=true# If an HTTP call returns blob contents, don't convert it to ASCII for the JSON file.c.preserve_exact_body_bytesdo |http_message|
http_message.body.encoding.name == 'ASCII-8BIT' ||
!http_message.body.valid_encoding?endend
Thanks!
The text was updated successfully, but these errors were encountered:
Just an FYI issue, not sure what the best solution is here. I think this is a bad interaction between WebMock and google-api-client.
I use VCR and WebMock underneath to record and replay all interactions with Google APIs in tests. Ever since upgrading from google-api-client
0.9.pre3
to0.9.1
all of my integration tests would break with:It turns out that
JSON::ParserError
is raised when given a blank string to decode. After digging in, sure enough all of my VCR cassette files had recorded responses with empty response body (even though Content-Length would still be correct).I dug through your spec_helper and found the monkey-patch for WebMock to support chunked responses—I thought that was it, but it turns out that I didn't need that, I only needed to add:
With that in my
spec_helper.rb
, everything works again because my cassettes record full response bodies again.I assume that this is a bad interaction between WebMock, VCR, and google-api-client, but I haven't narrowed it to the smallest case yet (and probably won't now that I have a fix). For reference, here are a few of my related config settings:
I run this in my
RSpec.configure
block in spec_helper:And my VCR setup is (slightly trimmed):
Thanks!
The text was updated successfully, but these errors were encountered: