DioNetworkClient constructor
DioNetworkClient({
- required Map<
String, String> commonHeadersProvider(), - @visibleForTesting HttpClientAdapter? httpClientAdapter,
Implementation
DioNetworkClient({
required this.commonHeadersProvider,
@visibleForTesting HttpClientAdapter? httpClientAdapter,
}) {
if (httpClientAdapter != null) _dio.httpClientAdapter = httpClientAdapter;
_dio.interceptors.add(
InterceptorsWrapper(
onRequest: (options, handler) {
// A header the call site set explicitly wins over the common one.
options.headers = {
..._buildCommonHeaders(),
...options.headers,
};
handler.next(options);
},
),
);
}