1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Fall back to the unstable endpoint if we receive a 405 status

This commit is contained in:
Andy Balaam
2023-01-06 15:22:58 +00:00
parent c4ca0b2e07
commit 628bcbf33a
2 changed files with 21 additions and 2 deletions

View File

@ -417,7 +417,7 @@ describe("MatrixClient", function () {
]);
});
it("should fallback to unstable endpoint when no support for stable endpoint", async () => {
it("should fallback to unstable endpoint when stable endpoint 404s", async () => {
await assertRequestsMade([
{
prefix: ClientPrefix.V1,
@ -433,6 +433,22 @@ describe("MatrixClient", function () {
]);
});
it("should fallback to unstable endpoint when stable endpoint 405s", async () => {
await assertRequestsMade([
{
prefix: ClientPrefix.V1,
error: {
httpStatus: 405,
errcode: "M_UNRECOGNIZED",
},
},
{
prefix: unstableMSC3030Prefix,
data: { event_id: eventId },
},
]);
});
it("should not fallback to unstable endpoint when stable endpoint returns an error", async () => {
await assertRequestsMade(
[