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

Reject promise on request timeout #306

Merged
merged 1 commit into from
Apr 2, 2016
Merged

Reject promise on request timeout #306

merged 1 commit into from
Apr 2, 2016

Conversation

dgraham
Copy link
Contributor

@dgraham dgraham commented Apr 1, 2016

Firefox and Chrome trigger the request's onerror handler when a timeout occurs. Safari triggers the ontimeout handler.

This can be observed by making a request to an unroutable address:

var xhr = new XMLHttpRequest()
xhr.onload = console.log.bind(console, 'loaded')
xhr.onerror = console.log.bind(console, 'errored')
xhr.ontimeout = console.log.bind(console, 'timeout')
xhr.open('GET', 'http://10.255.255.1')
xhr.send()

Fixes #294.

@mislav @fabioberger

Firefox and Chrome trigger the request's `onerror` handler when a
timeout occurs. Safari triggers the `ontimeout` handler.

This can be observed by making a request to an unroutable address:

    var xhr = new XMLHttpRequest()
    xhr.onload = console.log.bind(console, 'loaded')
    xhr.onerror = console.log.bind(console, 'errored')
    xhr.ontimeout = console.log.bind(console, 'timeout')
    xhr.open('GET', 'http://10.255.255.1')
    xhr.send()

Fixes #294.
@fabioberger
Copy link

Thanks for putting this together dgraham! I hope it gets merged soon!

@staabm
Copy link

staabm commented Apr 2, 2016

Would be great to have it documented in the source which lines covering which browser

@mislav
Copy link
Contributor

mislav commented Apr 2, 2016

👍 🚢

@dgraham dgraham merged commit 4dbbfd0 into master Apr 2, 2016
@dgraham dgraham deleted the timeout-reject branch April 2, 2016 16:45
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Neither then() nor catch() executed when request timeout in Safari
4 participants