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

How is redirect getting handled #28

Open
Ratnesh-Github opened this issue Mar 12, 2015 · 1 comment
Open

How is redirect getting handled #28

Ratnesh-Github opened this issue Mar 12, 2015 · 1 comment

Comments

@Ratnesh-Github
Copy link

Thanks for writing this module. I am making a post call to a server with username and password. The response code returned is 302. I am not able to find how redirect is getting handled in requestify.

@tevaum
Copy link

tevaum commented Apr 29, 2015

As far as I looked into the source code, redirect is reported as an error to the client code. I think it's this way because requestify should handle 3xx codes, but at the moment, it isn't handling. So if you want to handle them yourself, you should change the isSuccessfull function in lib/Requestify.js from:

return code >= 200 && code < 300;

to

return code >= 200 && code < 400;

With this change, you will get your events to fire up normaly and you can handle 300 codes yourself.

Hope that helps.

I'm planning to contribute more actively to requestify from now on, but I didn't contact the author yet to see if he plans on implementing this kind of stuff...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants