From 891375a885b513d90054a02cab066f10ba62b4aa Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 4 Feb 2022 16:35:47 +0530 Subject: [PATCH] Rename allowerErrors -> allowedStatusCodes --- src/matrix/net/HomeServerApi.ts | 4 ++-- src/matrix/net/HomeServerRequest.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/matrix/net/HomeServerApi.ts b/src/matrix/net/HomeServerApi.ts index 88ff32d9..605607b6 100644 --- a/src/matrix/net/HomeServerApi.ts +++ b/src/matrix/net/HomeServerApi.ts @@ -38,7 +38,7 @@ type Options = { type BaseRequestOptions = { log?: ILogItem; - allowedErrors?: number[]; + allowedStatusCodes?: number[]; uploadProgress?: (loadedBytes: number) => void; timeout?: number; prefix?: string; @@ -165,7 +165,7 @@ export class HomeServerApi { } register(username: string | null, password: string, initialDeviceDisplayName: string, auth?: Record, inhibitLogin: boolean = true , options: BaseRequestOptions = {}): IHomeServerRequest { - options.allowedErrors = [401]; + options.allowedStatusCodes = [401]; const body: any = { auth, password, diff --git a/src/matrix/net/HomeServerRequest.ts b/src/matrix/net/HomeServerRequest.ts index ee4ad2ba..d6745d03 100644 --- a/src/matrix/net/HomeServerRequest.ts +++ b/src/matrix/net/HomeServerRequest.ts @@ -27,7 +27,7 @@ export interface IHomeServerRequest { type HomeServerRequestOptions = { log?: ILogItem; - allowedErrors?: number[]; + allowedStatusCodes?: number[]; }; export class HomeServerRequest implements IHomeServerRequest { @@ -47,7 +47,7 @@ export class HomeServerRequest implements IHomeServerRequest { this._promise = sourceRequest.response().then(response => { log?.set("status", response.status); // ok? - if (response.status >= 200 && response.status < 300 || options?.allowedErrors?.includes(response.status)) { + if (response.status >= 200 && response.status < 300 || options?.allowedStatusCodes?.includes(response.status)) { log?.finish(); return response.body; } else {