mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
refactor: update authentication handling to check authData instead of enableAuth flag
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user