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

Ignoring not matching urls for cassettes #96

Open
wli0503 opened this issue Mar 30, 2017 · 2 comments
Open

Ignoring not matching urls for cassettes #96

wli0503 opened this issue Mar 30, 2017 · 2 comments

Comments

@wli0503
Copy link

wli0503 commented Mar 30, 2017

When using HTTPoison with :hackney, I got the error of response for [URL:#{params[:url]}, METHOD:#{params[:method]}] was not found. The requests are not the same one as recorded in the cassettes so I guess that's the reason it's not working as expected.

So I propose when using ExVCR mockups, we have a switch as bypass. Just like custom, when set to true, it will ignore all the requests that are not specified in the recorded cassettes. Here's an example:

  use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
  ...hooks and other test cases...
  test "it will bypass if the cassette did not match the request" do
    use_cassette "no_match", custom: true, bypass: true do
         HTTPoison.start
         assert HTTPoison.get("http://not_match_cassette.com").status_code == 200
     end
  end

By combining the custom switch and the bypass switch, we now have the request to be passed directly to the server instead of using a pre-recorded one.

See PR #97 for details. Let me know if you have any question or concern regarding to it. Any discussion is welcome.

@wli0503 wli0503 mentioned this issue Mar 30, 2017
@parroty
Copy link
Owner

parroty commented Apr 1, 2017

Thanks for the feedback and suggestions. Is it possible to show the actual response from server (or recorded cassette file)?
I'm wondering which part is actually causing the not-found error. It might be one way to add bypass type of option, but not sure enough yet. I think there're some other options to ignore certain part of attributes in the request.

@sadir
Copy link

sadir commented Dec 6, 2017

Hi @parroty - I've discovered a need for this functionality today. Is this planned/not going to happen/needs help and is open for PRs?

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

3 participants