1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Sanity-check response from /thirdparty/protocols

Check that /thirdparty/protocols gives us an object (rather than a string, for
instance). I saw a test explode, apparently because it gave us a string. Which
is odd, but in general we ought to be sanity-checking the things coming back
from the server.
This commit is contained in:
Richard van der Hoff
2017-07-05 10:51:08 +01:00
parent 6ae714f51f
commit 598d40b0b7

View File

@@ -1326,7 +1326,15 @@ MatrixBaseApis.prototype.getThirdpartyProtocols = function() {
return this._http.authedRequestWithPrefix( return this._http.authedRequestWithPrefix(
undefined, "GET", "/thirdparty/protocols", undefined, undefined, undefined, "GET", "/thirdparty/protocols", undefined, undefined,
httpApi.PREFIX_UNSTABLE, httpApi.PREFIX_UNSTABLE,
); ).then((response) => {
// sanity check
if (!response || typeof(response) !== 'object') {
throw new Error(
`/thirdparty/protocols did not return an object: ${response}`,
);
}
return response;
});
}; };
/** /**