Giter Site home page Giter Site logo

Comments (2)

wheresrhys avatar wheresrhys commented on July 16, 2024

To be honest, I'm not sure how useful being able to configure bad responses is. greed: 'good' is a feature I use from time to time, and it's also useful to be able to let unmatched requests pass through to native fetch. greed: 'bad' is only there for completeness really. I don't see it as running contrary to the fetch spec though: fetch 'will only reject on network failure, or if anything prevented the request from completing.' So greed: bad kinda equates to the worst case scenario for a fetch request.

I could add the ability to configure the behaviour more precisely e.g greed: {status code}, and will leave this issue open to see if anyone else wants the feature. Personally I think if the developer cares that much about status codes returned by the fetch calls in their test, then they should probably be mocking those calls individually or with some predefined routes.

What are you using/planning on using greed: bad for?

from fetch-mock.

danny-andrews avatar danny-andrews commented on July 16, 2024

I decided against using fetch, I was having too much friction trying to mock it out in tests. You make a good point about the network failure, though.

from fetch-mock.

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.