You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library rejects the promise when you set promise config.greed = bad (ref), but the fetch specification states:
The Promise returned from fetch() won't reject on HTTP error status even if the response is a HTTP 404 or 500. Instead, it will resolve normally, and it will only reject on network failure, or if anything prevented the request from completing.
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?
This library rejects the promise when you set promise
config.greed = bad
(ref), but the fetch specification states:https://github.com/github/fetch#caveats
We should just resolve as normal here.
The text was updated successfully, but these errors were encountered: