You've already forked matrix-js-sdk
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:
@@ -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;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user