Add XHR timeout handler
This commit is contained in:
parent
9dbb1a1786
commit
a858ad5434
|
@ -61,6 +61,7 @@ export const xhrRequest: IRequestFunction = (options: IRequestOptions): TPromise
|
|||
stream: new ArrayBufferStream(xhr.response)
|
||||
});
|
||||
};
|
||||
xhr.ontimeout = e => reject(new Error(`XHR timeout: ${options.timeout}ms`));
|
||||
|
||||
if (options.timeout) {
|
||||
xhr.timeout = options.timeout;
|
||||
|
|
|
@ -189,7 +189,7 @@ class RemoteSearchProvider {
|
|||
'Content-Type': 'application/json; charset=utf-8',
|
||||
'api-key': endpoint.key
|
||||
},
|
||||
timeout: 4000
|
||||
timeout: 5000
|
||||
})
|
||||
.then(context => {
|
||||
if (context.res.statusCode >= 300) {
|
||||
|
|
Loading…
Reference in a new issue