diff --git a/src/Request.ts b/src/Request.ts index 2ac41071..317a12c9 100644 --- a/src/Request.ts +++ b/src/Request.ts @@ -10,6 +10,7 @@ class Request { private contentType: string = "application/json; charset=UTF-8"; private authRequired: boolean = true; private upgradeRequired: boolean = true; + private checkRequestStatus: boolean | null = null; private headers: object = {}; constructor(url: string) { @@ -83,6 +84,16 @@ class Request { return this; } + + getCheckRequestStatus(): boolean | null { + return this.checkRequestStatus; + } + + setCheckRequestStatus(checkStatus: boolean | null) { + this.checkRequestStatus = checkStatus; + + return this; + } } export default Request; diff --git a/src/RequestService.ts b/src/RequestService.ts index 9aa09d20..1f27529b 100644 --- a/src/RequestService.ts +++ b/src/RequestService.ts @@ -343,7 +343,10 @@ class RequestService { const response = await this.makeClientRequest(request); const { data } = response; - if (this.checkRequestStatus && typeof data === "object") { + const checkRequestStatus = + request.getCheckRequestStatus() ?? this.checkRequestStatus; + + if (checkRequestStatus && typeof data === "object") { const { commandResponse } = data; if (commandResponse) { @@ -371,7 +374,8 @@ class RequestService { const request = new Request(url) .setMethod(RequestMethod.Get) - .setUpgradeRequired(false); + .setUpgradeRequired(false) + .setCheckRequestStatus(checkRequestStatus); return this.sendRequest(request); }