Skip to content

Commit

Permalink
Merge pull request #1307 from MTRNord/fix-keys_query_endpoint
Browse files Browse the repository at this point in the history
Use the correct request body for the /keys/query endpoint.
  • Loading branch information
uhoreg committed Apr 7, 2020
2 parents 66417e6 + bff8a94 commit 4d26252
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion spec/TestClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ TestClient.prototype.expectKeyQuery = function(response) {
200, (path, content) => {
Object.keys(response.device_keys).forEach((userId) => {
expect(content.device_keys[userId]).toEqual(
{},
[],
"Expected key query for " + userId + ", got " +
Object.keys(content.device_keys),
);
Expand Down
4 changes: 2 additions & 2 deletions spec/integ/matrix-client-crypto.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function expectAliQueryKeys() {
aliTestClient.httpBackend.when("POST", "/keys/query")
.respond(200, function(path, content) {
expect(content.device_keys[bobUserId]).toEqual(
{},
[],
"Expected Alice to key query for " + bobUserId + ", got " +
Object.keys(content.device_keys),
);
Expand Down Expand Up @@ -98,7 +98,7 @@ function expectBobQueryKeys() {
"POST", "/keys/query",
).respond(200, function(path, content) {
expect(content.device_keys[aliUserId]).toEqual(
{},
[],
"Expected Bob to key query for " + aliUserId + ", got " +
Object.keys(content.device_keys),
);
Expand Down
4 changes: 2 additions & 2 deletions spec/integ/matrix-client-methods.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ describe("MatrixClient", function() {

httpBackend.when("POST", "/keys/query").check(function(req) {
expect(req.data).toEqual({device_keys: {
'boris': {},
'chaz': {},
'boris': [],
'chaz': [],
}});
}).respond(200, {
device_keys: {
Expand Down
2 changes: 1 addition & 1 deletion src/base-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,7 @@ MatrixBaseApis.prototype.downloadKeysForUsers = function(userIds, opts) {
content.token = opts.token;
}
userIds.forEach((u) => {
content.device_keys[u] = {};
content.device_keys[u] = [];
});

return this._http.authedRequest(undefined, "POST", "/keys/query", undefined, content);
Expand Down

0 comments on commit 4d26252

Please sign in to comment.