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

Modernize http-api - move from browser-request to fetch (#2719)

This commit is contained in:
Michael Telatynski
2022-10-12 18:59:04 +01:00
committed by GitHub
parent 913660c818
commit 34c5598a3f
56 changed files with 2528 additions and 2543 deletions

View File

@ -5,7 +5,6 @@ import { MatrixClient } from "../../src/matrix";
import { MatrixScheduler } from "../../src/scheduler";
import { MemoryStore } from "../../src/store/memory";
import { MatrixError } from "../../src/http-api";
import { ICreateClientOpts } from "../../src/client";
import { IStore } from "../../src/store";
describe("MatrixClient opts", function() {
@ -69,7 +68,7 @@ describe("MatrixClient opts", function() {
let client;
beforeEach(function() {
client = new MatrixClient({
request: httpBackend.requestFn as unknown as ICreateClientOpts['request'],
fetchFn: httpBackend.fetchFn as typeof global.fetch,
store: undefined,
baseUrl: baseUrl,
userId: userId,
@ -129,7 +128,7 @@ describe("MatrixClient opts", function() {
let client;
beforeEach(function() {
client = new MatrixClient({
request: httpBackend.requestFn as unknown as ICreateClientOpts['request'],
fetchFn: httpBackend.fetchFn as typeof global.fetch,
store: new MemoryStore() as IStore,
baseUrl: baseUrl,
userId: userId,
@ -143,7 +142,7 @@ describe("MatrixClient opts", function() {
});
it("shouldn't retry sending events", function(done) {
httpBackend.when("PUT", "/txn1").fail(500, new MatrixError({
httpBackend.when("PUT", "/txn1").respond(500, new MatrixError({
errcode: "M_SOMETHING",
error: "Ruh roh",
}));