Code Monkey home page Code Monkey logo

Comments (3)

parroty avatar parroty commented on July 24, 2024

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.

smdern avatar smdern commented on July 24, 2024

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.

TMSCH avatar TMSCH commented on July 24, 2024

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)

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.