Skip to content

Commit

Permalink
Revert "Add constructor for DioExceptionType.badCertificate"
Browse files Browse the repository at this point in the history
This reverts commit 930d6c6.
  • Loading branch information
hgraceb committed Apr 19, 2024
1 parent fde97b1 commit 57e0678
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
1 change: 0 additions & 1 deletion dio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ See the [Migration Guide][] for the complete breaking changes list.**
## Unreleased

- Raise the min Dart SDK version to 2.18.0.
- Add constructor for `DioExceptionType.badCertificate`.

## 5.4.3+1

Expand Down
4 changes: 3 additions & 1 deletion dio/lib/src/adapters/io_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ class IOHttpClientAdapter implements HttpClientAdapter {
port,
);
if (!isCertApproved) {
throw DioException.badCertificate(
throw DioException(
requestOptions: options,
type: DioExceptionType.badCertificate,
error: responseStream.certificate,
message: 'The certificate of the response is not approved.',
);
}
}
Expand Down
14 changes: 1 addition & 13 deletions dio/lib/src/dio_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum DioExceptionType {
/// It occurs when url is sent timeout.
sendTimeout,

/// It occurs when receiving timeout.
///It occurs when receiving timeout.
receiveTimeout,

/// Caused by an incorrect certificate as configured by [ValidateCertificate].
Expand Down Expand Up @@ -142,18 +142,6 @@ class DioException implements Exception {
error: error,
);

factory DioException.badCertificate({
required RequestOptions requestOptions,
Object? error,
}) =>
DioException(
type: DioExceptionType.badCertificate,
message: 'The certificate of the response is not approved.',
requestOptions: requestOptions,
response: null,
error: error,
);

factory DioException.requestCancelled({
required RequestOptions requestOptions,
required Object? reason,
Expand Down
4 changes: 2 additions & 2 deletions dio/lib/src/interceptors/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ class LogInterceptor extends Interceptor {
/// Log printer; defaults print log to console.
/// In flutter, you'd better use debugPrint.
/// you can also write log in a file, for example:
/// ```dart
///```dart
/// final file=File("./log.txt");
/// final sink=file.openWrite();
/// dio.interceptors.add(LogInterceptor(logPrint: sink.writeln));
/// ...
/// await sink.close();
/// ```
///```
void Function(Object object) logPrint;

@override
Expand Down

0 comments on commit 57e0678

Please sign in to comment.