Comments (3)
Thanks for the feedback! Regarding the default, I'm not so confident about adding them by default (yet). I think your point about false test coverage makes sense, but I was assuming that these params can fluctuate depending on the servers/services and can cause the error.
I'm seeing the ruby's VCR library docs, and seems not going into these strict matches.
https://relishapp.com/vcr/vcr/v/3-0-1/docs/request-matching
In order to properly replay previously recorded requests, VCR must match new
HTTP requests to a previously recorded one. By default, it matches on HTTP
method and URI, since that is usually deterministic and fully identifies the
resource and action for typical RESTful APIs.
However,
At the very least, there should be a global config option to override this behavior, ...
This part is just a missing functionality and I don't have concern about adding one. Maybe having default setting (ex. in config.exs
).
I would like to add this setting, having some difficulties to spare time. PR is appreciated 😄
What do you think?
from exvcr.
I created a PR to address this. #47
You can override the default match_requests_on
to something like this:
use Mix.Config
config :exvcr, [
match_requests_on: [:query, :request_body],
]
from exvcr.
I agree with @jsteiner that the default should match against URL, query params and body. All these pieces of data will trigger a different behavior of the server, it should matter to the developers when they change.
Some other reasons:
- avoid issues where the reply doesn't behave as the original, b/c query params/body info are dropped and incorrect requests are matched.
- avoid regression where changing the query params or body of the request still pass the test, when it doesn't against the real servers.
- stricter by default is just better. It should be a conscious decision of the developers to NOT use strict mode.
- not all servers are RESTful servers. In fact, a lot aren't.
As you quoted, VCR explains their decisions was made so that it works against RESTful API. I don't think this is a valid assumption, that every developer will work against RESTful API. Also, being stricter in the context of RESTful API will not be detrimental.
I'm happy to discuss further, I don't see any valid reason to keep the current behavior of VCR in ExVCR, also happy to make a PR to update the default.
from exvcr.
Related Issues (20)
- Request was made? HOT 1
- ExVCR.IEx not working with adapter: ExVCR.Adapter.Hackney HOT 2
- disable global mock HOT 14
- Global Mock does not use cassettes with HTTPoison HOT 2
- How to use ExVCR with Finch? HOT 3
- Filter sensitive data after all request made HOT 1
- Support `mix vcr.check --include mytag` ?
- Can't match json response bodies for removing sensitive data? HOT 1
- Cassettes are not injected after test cases! HOT 1
- ** (ArgumentError) argument error
- Support for Finch 0.9.x? HOT 1
- Feature request: `start_cassette` and `stop_cassette`
- Same as vcr request: save response json body with more formatting HOT 1
- Generated custom_cassettes with patchfile HOT 1
- Wrong responses when HTTPoison is used from async Task HOT 4
- Async tests using Bypass interfere with ExVcr tests HOT 3
- support httpoison 2.0 HOT 1
- Version `0.14.0` cannot be compiled in projects not using `Finch`
- Unable to record when specifying a receive_timeout option
- Long list of warnings on Elixir 1.16 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exvcr.