refactor: update authentication handling to check authData instead of enableAuth flag

This commit is contained in:
Udhay-Adithya
2025-07-06 12:28:35 +05:30
parent c39b8fbe6d
commit 32855fd2f9
2 changed files with 1 additions and 3 deletions

View File

@@ -20,7 +20,6 @@ Future<(HttpResponse?, Duration?, String?)> sendHttpRequest(
HttpRequestModel requestModel, { HttpRequestModel requestModel, {
SupportedUriSchemes defaultUriScheme = kDefaultUriScheme, SupportedUriSchemes defaultUriScheme = kDefaultUriScheme,
bool noSSL = false, bool noSSL = false,
bool enableAuth = true,
}) async { }) async {
if (httpClientManager.wasRequestCancelled(requestId)) { if (httpClientManager.wasRequestCancelled(requestId)) {
httpClientManager.removeCancelledRequest(requestId); httpClientManager.removeCancelledRequest(requestId);
@@ -30,7 +29,7 @@ Future<(HttpResponse?, Duration?, String?)> sendHttpRequest(
HttpRequestModel authenticatedRequestModel = requestModel.copyWith(); HttpRequestModel authenticatedRequestModel = requestModel.copyWith();
try { try {
if (enableAuth) { if (authData != null && authData.type != APIAuthType.none) {
authenticatedRequestModel = await handleAuth(requestModel, authData); authenticatedRequestModel = await handleAuth(requestModel, authData);
} }
} catch (e) { } catch (e) {

View File

@@ -111,7 +111,6 @@ Future<HttpRequestModel> handleAuth(
APIType.rest, APIType.rest,
authData, authData,
httpRequestModel, httpRequestModel,
enableAuth: false,
); );
final httpResponse = httpResult.$1; final httpResponse = httpResult.$1;