Code Monkey home page Code Monkey logo

Comments (8)

cibernox avatar cibernox commented on August 15, 2024

fetch by design only rejects if there is a network issue(being offline p.e). You need to check for response.ok to know if the request was successful or not. That is how fetch works.

from ember-fetch.

orf avatar orf commented on August 15, 2024

So even if the site I'm connecting to is offline, it's still a successful promise?

I understand that it doesn't reject on status codes, but not rejecting on network errors is confusing. Thanks anyway!

from ember-fetch.

cibernox avatar cibernox commented on August 15, 2024

On network errors it should reject indeed. If it doesn't it's a bug, but this polyfill is so popular that I don't think that's possible. Are you talking about tests?

from ember-fetch.

orf avatar orf commented on August 15, 2024

I've got a fiddle here: https://ember-twiddle.com/625abf7d2eff52a579bf2d82c1eceadc?openFiles=controllers.application.js%2C

I get:

DNS pollyfill: false
DNS fetch: true
SSL pollyfill: false
SSL fetch: true

I am behind a proxy, but still, there seems to be a difference. Can you replicate this?

from ember-fetch.

orf avatar orf commented on August 15, 2024

Using [email protected] results in true for all 4 cases. It appears that this change (10ea9e1) may have introduced it.

from ember-fetch.

cibernox avatar cibernox commented on August 15, 2024

Actually I see the error now. I'll see if I can fix it tonight. Essentially we need to return a rejected promise from the second then so we propagate the rejection

from ember-fetch.

rwjblue avatar rwjblue commented on August 15, 2024

Damn. Yes, I need to rethrow. 🤦‍♂️

from ember-fetch.

stefanpenner avatar stefanpenner commented on August 15, 2024

@rwjblue / @cibernox just a headsup. Master will be a major version bump. So I have created a release-2 branch for all work destined for a 2x release (which this seems part of)

https://github.com/stefanpenner/ember-fetch/commits/release-2

from ember-fetch.

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.