Use includes instead of elaborate find

Co-authored-by: Bruno Windels <brunow@matrix.org>
This commit is contained in:
R Midhun Suresh 2022-02-03 12:01:08 +05:30 committed by RMidhunSuresh
parent a351a185a0
commit 30cb9f6d15

View File

@ -42,7 +42,7 @@ export class HomeServerRequest implements IHomeServerRequest {
this._promise = sourceRequest.response().then(response => { this._promise = sourceRequest.response().then(response => {
log?.set("status", response.status); log?.set("status", response.status);
// ok? // ok?
if (response.status >= 200 && response.status < 300 || options?.allowedErrors?.find(e => e === response.status)) { if (response.status >= 200 && response.status < 300 || options?.allowedErrors?.includes(response.status)) {
log?.finish(); log?.finish();
return response.body; return response.body;
} else { } else {