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

VCR not catching NetHttp2 requests #976

Open
itsmeurbi opened this issue Jun 14, 2023 · 2 comments · May be fixed by #1021
Open

VCR not catching NetHttp2 requests #976

itsmeurbi opened this issue Jun 14, 2023 · 2 comments · May be fixed by #1021

Comments

@itsmeurbi
Copy link

When trying to create specs for our implementation of Appnotic, I find out VCR is just not working properly. Looks like VCR has no support for NetHttp2(used by Apnotic)

This is all VCR config we have on spec_helper.rb

require 'vcr'

VCR.configure do |config|
  config.cassette_library_dir = 'spec/support/vcr_cassettes'
  config.hook_into :webmock
end
WebMock.disable_net_connect!(allow_localhost: true, allow: 'stripe.com')

To replicate issue:

require 'rails_helper'

RSpec.describe 'MyClass' do
  it 'records request' do
    VCR.use_cassette('my_cassette') do
      client = NetHttp2::Client.new("http://nghttp2.org")
      response = client.call(:get, '/')

      expect(response.ok?). to_be(true)
    end
  end
end

Current behavior:

Request is not being intercepted by VCR. Nothing is stored in my_cassette.yml and request goes to the 'real world' as many times as the specs is executed

Expected behavior:

VCR intercepts the request and store the response inside my_cassette.yml, so it is used next time the spec is executed

Ruby 3.1.4
Gem 6..1.0
HTTP NetHttp2
Mock 3.18.1
Rails 6.1.7.3
Rspec 3.12

@tomrossi7
Copy link

We need this as well.

@olleolleolle
Copy link
Member

So, to support NetHttp2, VCR will need a new adapter, perhaps easiest done by adding support as a WebMock adapter.

Resources for the interested hacker:

@joaoGabriel55 joaoGabriel55 linked a pull request Jul 19, 2024 that will close this issue
@olleolleolle olleolleolle linked a pull request Jul 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants