Merge pull request #1014 from matrix-org/dbkr/throw_if_no_id_url

Throw an exception if trying to do an ID server request with no ID server
This commit is contained in:
David Baker
2019-08-13 10:41:04 +01:00
committed by GitHub
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -1731,6 +1731,10 @@ MatrixBaseApis.prototype.getKeyChanges = function(oldToken, newToken) {
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.registerWithIdentityServer = function(hsOpenIdToken) {
if (!this.idBaseUrl) {
throw new Error("No Identity Server base URL set");
}
const uri = this.idBaseUrl + httpApi.PREFIX_IDENTITY_V2 + "/account/register";
return this._http.requestOtherUrl(
undefined, "POST", uri,
+4
View File
@@ -389,6 +389,10 @@ module.exports.MatrixHttpApi.prototype = {
prefix,
accessToken,
) {
if (!this.opts.idBaseUrl) {
throw new Error("No Identity Server base URL set");
}
const fullUri = this.opts.idBaseUrl + prefix + path;
if (callback !== undefined && !utils.isFunction(callback)) {