Skip to content

Commit

Permalink
Fix POST body for v2 IS requests
Browse files Browse the repository at this point in the history
POST bodies for v2 IS requests must be sent as JSON.

Part of element-hq/element-web#10159
  • Loading branch information
jryans committed Aug 8, 2019
1 parent 64ddbd9 commit 8c15125
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/base-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,8 @@ MatrixBaseApis.prototype.requestEmailToken = async function(
try {
const response = await this._http.idServerRequest(
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
if (callback) callback(null, response);
Expand Down Expand Up @@ -1824,7 +1825,8 @@ MatrixBaseApis.prototype.submitMsisdnToken = async function(
try {
return await this._http.idServerRequest(
undefined, "POST", "/validate/msisdn/submitToken",
params, httpApi.PREFIX_IDENTITY_V2, identityAccessToken,
JSON.stringify(params), httpApi.PREFIX_IDENTITY_V2,
identityAccessToken,
);
} catch (err) {
if (err.cors === "rejected" || err.httpStatus === 404) {
Expand Down

0 comments on commit 8c15125

Please sign in to comment.