Respect timeout option in XHR-based requestService. Add timeout to remote preferences search

This commit is contained in:
Rob Lourens
2017-11-20 18:21:17 -08:00
parent 7c6e4a07fc
commit dc94e708ac
2 changed files with 6 additions and 1 deletions
@@ -62,6 +62,10 @@ export const xhrRequest: IRequestFunction = (options: IRequestOptions): TPromise
});
};
if (options.timeout) {
xhr.timeout = options.timeout;
}
xhr.send(options.data);
return null;
@@ -188,7 +188,8 @@ class RemoteSearchProvider {
'User-Agent': 'request',
'Content-Type': 'application/json; charset=utf-8',
'api-key': endpoint.key
}
},
timeout: 4000
})
.then(context => {
if (context.res.statusCode >= 300) {