mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Handle timeout on XHR requests
This commit is contained in:
@@ -76,6 +76,14 @@ module.exports = function xhrAdapter(resolve, reject, config) {
|
|||||||
request = null;
|
request = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle timeout
|
||||||
|
request.ontimeout = function handleTimeout() {
|
||||||
|
reject(new Error('Timeout'));
|
||||||
|
|
||||||
|
// Clean up request
|
||||||
|
request = null;
|
||||||
|
};
|
||||||
|
|
||||||
// Add xsrf header
|
// Add xsrf header
|
||||||
// This is only done if running in a standard browser environment.
|
// This is only done if running in a standard browser environment.
|
||||||
// Specifically not if we're in a web worker, or react-native.
|
// Specifically not if we're in a web worker, or react-native.
|
||||||
|
|||||||
Reference in New Issue
Block a user