-
Notifications
You must be signed in to change notification settings - Fork 96
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
Aborting an XHR still results in a timeout callback #104
Comments
Confirmed, nice catch. Thanks. I can't promise I'll fix it this week, so let me know if you'd like to PR this with a test ;) |
What's the correct behavior? Should the callback be called with a timeout error right away? I started to write a test and then realized I didn't know what I should be asserting. Not calling the callback at all sounds like a way to tempt Zalgo. |
Based on issue #93, I propose that
Does that sound reasonable? I don't like the idea of no longer calling the callback at all, if only for the reason that it would be a breaking API change. |
We want to mimic how request/request is reacting to This issue is about the internal timeout we use instead of the one on Here's a solution https://github.com/Raynos/xhr/tree/abort-timeout, but it'd require extensive cross-browser testing before merging in. |
Looking for volunteers to test in IEs, Safari etc. |
The issue seems to be around here: https://github.com/Raynos/xhr/blob/master/index.js#L184
When XHRs are aborted, the timeout isn't cleared. When the timer function is invoked, it doesn't first check the status of the XHR before executing the callback.
A possible solution is to listen for the
abort
event and clear the timeout.The text was updated successfully, but these errors were encountered: