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
I was having issues w/ VCR not recording cassettes when using JsonApiClient, despite the Faraday underpinnings. The issue appears to be the following lines in connection.rb:
# insert middleware before ParseJson - middleware executed in reverse order -# inserted middleware will run after json parseddefuse(middleware, *args, &block)returniffaraday.builder.locked?faraday.builder.insert_before(Middleware::ParseJson,middleware, *args, &block)end
Because Connection wraps the Faraday connection, I believe the VCR-provided hook_into :faraday was ineffective. Adding the middleware manually using connection.use VCR::Middleware::Faraday results in an ArgumentError: VCR::Response initialized with an invalid body: <Hash …>.
The solution, for me, was to insert the VCR middleware afterMiddleware::ParseJson:
I was having issues w/ VCR not recording cassettes when using JsonApiClient, despite the Faraday underpinnings. The issue appears to be the following lines in connection.rb:
Because
Connection
wraps the Faraday connection, I believe the VCR-providedhook_into :faraday
was ineffective. Adding the middleware manually usingconnection.use VCR::Middleware::Faraday
results in anArgumentError: VCR::Response initialized with an invalid body: <Hash …>
.The solution, for me, was to insert the VCR middleware after
Middleware::ParseJson
:Note:
API::Base
in the example above inherits fromJsonApiClient::Resource
.The text was updated successfully, but these errors were encountered: