diff --git a/spec/unit/matrix-client.spec.ts b/spec/unit/matrix-client.spec.ts index 75af3b6dda1..920bec55804 100644 --- a/spec/unit/matrix-client.spec.ts +++ b/spec/unit/matrix-client.spec.ts @@ -2211,8 +2211,7 @@ describe("MatrixClient", function () { "org.matrix.msc3391": true, }, }; - jest.spyOn(client.http, "request").mockResolvedValue(versionsResponse); - const requestSpy = jest.spyOn(client.http, "authedRequest").mockImplementation(() => Promise.resolve()); + const requestSpy = jest.spyOn(client.http, "authedRequest").mockResolvedValue(versionsResponse); const unstablePrefix = "/_matrix/client/unstable/org.matrix.msc3391"; const path = `/user/${encodeURIComponent(userId)}/account_data/${eventType}`; @@ -2250,8 +2249,7 @@ describe("MatrixClient", function () { "org.matrix.msc3391": false, }, }; - jest.spyOn(client.http, "request").mockResolvedValue(versionsResponse); - const requestSpy = jest.spyOn(client.http, "authedRequest").mockImplementation(() => Promise.resolve()); + const requestSpy = jest.spyOn(client.http, "authedRequest").mockResolvedValue(versionsResponse); const path = `/user/${encodeURIComponent(userId)}/account_data/${eventType}`; // populate version support diff --git a/src/client.ts b/src/client.ts index b10949e2242..73ed7bbba44 100644 --- a/src/client.ts +++ b/src/client.ts @@ -7450,16 +7450,11 @@ export class MatrixClient extends TypedEventEmitter( - Method.Get, - "/_matrix/client/versions", - undefined, // queryParams - undefined, // data - { - prefix: "", - }, - ) + .authedRequest(Method.Get, "/_matrix/client/versions", undefined, undefined, { + prefix: "", + }) .catch((e) => { // Need to unset this if it fails, otherwise we'll never retry this.serverVersionsPromise = undefined; @@ -7732,6 +7727,8 @@ export class MatrixClient extends TypedEventEmitter