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

Fix POST body for v2 IS requests

POST bodies for v2 IS requests must be sent as JSON.

Part of https://github.com/vector-im/riot-web/issues/10159
This commit is contained in:
J. Ryan Stinnett
2019-08-08 10:29:14 +01:00
parent 64ddbd97dd
commit 8c15125e23

View File

@@ -1769,7 +1769,8 @@ MatrixBaseApis.prototype.requestEmailToken = async function(
try { try {
const response = await this._http.idServerRequest( const response = await this._http.idServerRequest(
undefined, "POST", "/validate/email/requestToken", undefined, "POST", "/validate/email/requestToken",
params, httpApi.PREFIX_IDENTITY_V2, identityAccessToken, JSON.stringify(params), httpApi.PREFIX_IDENTITY_V2,
identityAccessToken,
); );
// TODO: Fold callback into above call once v1 path below is removed // TODO: Fold callback into above call once v1 path below is removed
if (callback) callback(null, response); if (callback) callback(null, response);
@@ -1824,7 +1825,8 @@ MatrixBaseApis.prototype.submitMsisdnToken = async function(
try { try {
return await this._http.idServerRequest( return await this._http.idServerRequest(
undefined, "POST", "/validate/msisdn/submitToken", undefined, "POST", "/validate/msisdn/submitToken",
params, httpApi.PREFIX_IDENTITY_V2, identityAccessToken, JSON.stringify(params), httpApi.PREFIX_IDENTITY_V2,
identityAccessToken,
); );
} catch (err) { } catch (err) {
if (err.cors === "rejected" || err.httpStatus === 404) { if (err.cors === "rejected" || err.httpStatus === 404) {