The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/tests/mocks/utils/FakeResponse.ts

25 lines
460 B

export class FakeResponse {
private _body: string;
status: number;
headers: Record<string, string>;
constructor(body: string, init: { status?: number; headers?: Record<string, string> } = {}) {
this._body = body;
this.status = init.status ?? 200;
this.headers = init.headers ?? {};
}
get ok() {
return this.status >= 200 && this.status < 300;
}
async json() {
return JSON.parse(this._body);
}
async text() {
return this._body;
}
}