1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

More paranoia when handling responses

This commit is contained in:
Kegan Dougal
2015-10-21 16:00:31 +01:00
parent 02b836698c
commit 2c805bbece

View File

@@ -111,6 +111,11 @@ module.exports.MatrixHttpApi.prototype = {
case global.XMLHttpRequest.DONE:
clearTimeout(xhr.timeout_timer);
if (!xhr.responseText) {
cb(new Error('No response body.'));
return;
}
var resp = JSON.parse(xhr.responseText);
if (resp.content_uri === undefined) {
cb(new Error('Bad response'));