Giter Site home page Giter Site logo

epignosisx / vcr.net Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 1.0 66 KB

Record your .NET Core test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.

License: MIT License

C# 99.09% PowerShell 0.91%

vcr.net's People

Contributors

epignosisx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

tb-x

vcr.net's Issues

Setting RecordMode to 'None' for a Request with no Recorded Cassette Results in MatchNotFoundException

Hello,
I was looking for a means to disable VCR.NET recording/playback (while sussing out the external resource / etc., without having to go and delete the newly-created Cassette file after every test run). So, I attempted the following:

_vcr.UseCassette(cassetteName, RecordMode.None)
  • Expected behavior: The HTTP request goes through, with VCR.NET effectively no-oping. No recording, no playback attempts.
  • Actual behavior: MatchNotFoundException is thrown (if there's no cassette file recorded)

Is there some other way I can inform VCR to basically do nothing for playback and recording so I can just let the HTTP traffic flow through without any VCR interaction?

DefaultRequestMatcher IgnoreHeaders not working

In my test case, I'm trying to use the RecordMode.Once to record the cassettes in the first run and then replay the payloads during consecutive runs. The API that I'm recording is using API key authentication in headers. I don't want to store the API Key in a cassette in source control and I don't want to compare this header during playbacks.

I tried to use the IgnoreHeaders property of DefaultRequestMatcher but it is not used during the recording (which conceptually makes sense for your design). On the other hand, when replaying, the IgnoreHeaders seems to be used as a blacklist, but it should be a whitelist for comparison.

if (IgnoreHeaders.Contains(recordedHeader.Key))
    return false; // <---

should be:

if (IgnoreHeaders.Contains(recordedHeader.Key))
    continue; // <---
  1. Is my thinking correct?
  2. Is there a way to ignore a header when recording cassettes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.