2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-14 18:42:33 +03:00

Handle timeout on XHR requests

This commit is contained in:
Rogério Chaves
2016-02-05 16:26:58 -02:00
parent 235f34312c
commit 893c061dd6
+8
View File
@@ -76,6 +76,14 @@ module.exports = function xhrAdapter(resolve, reject, config) {
request = null;
};
// Handle timeout
request.ontimeout = function handleTimeout() {
reject(new Error('Timeout'));
// Clean up request
request = null;
};
// Add xsrf header
// This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native.