Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3xx status appear as failure? #39

Closed
MarkMurphy opened this issue Jan 24, 2016 · 5 comments
Closed

3xx status appear as failure? #39

MarkMurphy opened this issue Jan 24, 2016 · 5 comments

Comments

@MarkMurphy
Copy link

After browsing through the repo, unless I'm mistaken, it appears as though any server response above 299 will be treated as an error. What about redirects ie. (responses with status codes in the 3xx range)?

It think it's a bit awkward to treat a simple redirect as an error, though some clients might want to do that, I can't see all of them wanting to do that.

@masad-frost
Copy link

+1, main problem is 304

@barrystaes
Copy link
Contributor

How could we handle such a redirect.. can fetch() handle this?

If this can be improved in a PR, i'd like to merge in the upcoming 2.0 release.

@barrystaes barrystaes added this to the 2.0.x milestone Feb 19, 2016
@nason
Copy link
Collaborator

nason commented Nov 20, 2017

I believe this comes from the use of res.ok here:

if (res.ok) {
return next(await actionWith(successType, [action, getState(), res]));
} else {
return next(
await actionWith(
{
...failureType,
error: true
},
[action, getState(), res]
)
);
}

If we make this configurable, this middleware should be able to support use cases like this one.

@nason
Copy link
Collaborator

nason commented Mar 3, 2018

This is being looked at in #171

@nason nason modified the milestones: 2.0.0, 3.0 Mar 3, 2018
@nason
Copy link
Collaborator

nason commented Jun 10, 2018

In 2.x, you can now pass a custom fetch implementation
In 3.x (upcoming), you'll be able to pass a custom ok check

I think this should be enough to handle most situations, so I'm going to close this out. Feel free to re-open or continue commenting here though.

@nason nason closed this as completed Jun 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants