Skip to content

Commit

Permalink
🥅 Throw if cancelled before established
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Jun 18, 2024
1 parent 97b4830 commit 875a801
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dio/lib/src/dio_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,12 @@ abstract class DioMixin implements Dio {
Options? options,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) {
}) async {
if (cancelToken != null && cancelToken.isCancelled) {
final exception = await cancelToken.whenCancel;
throw exception;
}

final requestOptions = (options ?? Options()).compose(
this.options,
path,
Expand Down

0 comments on commit 875a801

Please sign in to comment.