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

Add API for bulk lookup on the Identity Server

This adds support for querying `/bulk_lookup` on the IS to check several 3PIDs
at the same time.

Part of https://github.com/vector-im/riot-web/issues/10159
This commit is contained in:
J. Ryan Stinnett
2019-08-07 17:45:13 +01:00
parent 35f1cdf89c
commit 8f016726f0
2 changed files with 45 additions and 4 deletions

View File

@@ -396,16 +396,19 @@ module.exports.MatrixHttpApi.prototype = {
withCredentials: false,
json: false,
_matrix_opts: this.opts,
headers: {},
};
if (method == 'GET') {
opts.qs = params;
} else {
} else if (typeof params === "object") {
opts.form = params;
} else if (typeof params === "string") {
// Assume the caller has serialised the body to JSON
opts.body = params;
opts.headers['Content-Type'] = "application/json";
}
if (accessToken) {
opts.headers = {
Authorization: `Bearer ${accessToken}`,
};
opts.headers['Authorization'] = `Bearer ${accessToken}`;
}
const defer = Promise.defer();