check request.status in httpsync.js to prevent throwing errors when undefined

This commit is contained in:
cubedro 2015-02-12 07:03:59 +02:00
parent ad8112c05a
commit af7c26b163
1 changed files with 5 additions and 3 deletions

View File

@ -32,13 +32,15 @@ var HttpSyncProvider = function (host) {
HttpSyncProvider.prototype.send = function (payload) {
//var data = formatJsonRpcObject(payload);
var request = new XMLHttpRequest();
request.open('POST', this.host, false);
request.send(JSON.stringify(payload));
// check request.status
var result = request.responseText;
// check request.status
if(request.status !== 200)
return;
return JSON.parse(result);
};