HttpConfig constructor
HttpConfig({
- required String baseUrl,
- Duration connectTimeout = const Duration(seconds: 15),
- Duration receiveTimeout = const Duration(seconds: 15),
- Duration sendTimeout = const Duration(seconds: 15),
- Map<
String, dynamic> commonHeaders()?, - List<
Interceptor> interceptors = const [], - bool enableLog = true,
- int maxLogLength = 16 * 1024,
- HttpLogSanitizer? sanitizeLog,
- HttpLogEnabledPredicate? shouldLog,
- bool enableToken = true,
- bool enableRetry = true,
- int maxRetries = 3,
- Duration retriesDelay = const Duration(seconds: 1),
- Set<
String> retryableMethods = defaultRetryableMethods, - String? getToken()?,
- Future<
String> onRefreshToken()?, - Future<
void> onRefreshTokenFailed()?,
Implementation
HttpConfig({
required this.baseUrl,
this.connectTimeout = const Duration(seconds: 15),
this.receiveTimeout = const Duration(seconds: 15),
this.sendTimeout = const Duration(seconds: 15),
this.commonHeaders,
this.interceptors = const [],
this.enableLog = true,
this.maxLogLength = 16 * 1024,
this.sanitizeLog,
this.shouldLog,
this.enableToken = true,
this.enableRetry = true,
this.maxRetries = 3,
this.retriesDelay = const Duration(seconds: 1),
Set<String> retryableMethods = defaultRetryableMethods,
this.getToken,
this.onRefreshToken,
this.onRefreshTokenFailed,
}) : retryableMethods = Set.unmodifiable(
retryableMethods.map((method) => method.trim().toUpperCase()),
);