File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ See the [Migration Guide][] for the complete breaking changes list.**
99- Add constructor for ` DioExceptionType.badCertificate ` .
1010- Create type alias ` DioMediaType ` for ` http_parser ` 's ` MediaType ` .
1111- Fix the type conversion regression when using ` MultipartFile.fromBytes ` .
12+ - Improves ` InterceptorState.toString() ` .
1213
1314## 5.4.3+1
1415
Original file line number Diff line number Diff line change 11part of 'dio_mixin.dart' ;
22
3- /// @nodoc
3+ /// The result type after handled by the interceptor.
44enum InterceptorResultType {
55 next,
66 resolve,
@@ -10,12 +10,14 @@ enum InterceptorResultType {
1010}
1111
1212/// Used to pass state between interceptors.
13- /// @nodoc
1413class InterceptorState <T > {
1514 const InterceptorState (this .data, [this .type = InterceptorResultType .next]);
1615
1716 final T data;
1817 final InterceptorResultType type;
18+
19+ @override
20+ String toString () => 'InterceptorState<$T >(type: $type , data: $data )' ;
1921}
2022
2123abstract class _BaseHandler {
Original file line number Diff line number Diff line change 11import 'dart:async' ;
22
33import 'package:dio/dio.dart' ;
4+ import 'package:dio/src/dio_mixin.dart' ;
45import 'package:dio/src/interceptors/imply_content_type.dart' ;
56import 'package:test/test.dart' ;
67
@@ -85,6 +86,20 @@ void main() {
8586 );
8687 });
8788
89+ group ('InterceptorState' , () {
90+ test ('toString()' , () {
91+ final data = DioException (requestOptions: RequestOptions ());
92+ final state = InterceptorState <DioException >(data);
93+ expect (
94+ state.toString (),
95+ 'InterceptorState<DioException>('
96+ 'type: InterceptorResultType.next, '
97+ 'data: DioException [unknown]: null'
98+ ')' ,
99+ );
100+ });
101+ });
102+
88103 group ('Request Interceptor' , () {
89104 test ('interceptor chain' , () async {
90105 final dio = Dio ();
You can’t perform that action at this time.
0 commit comments