Skip to content

Commit e1318d0

Browse files
committed
update to 2.1.5
1 parent 8e062e7 commit e1318d0

File tree

4 files changed

+24
-36
lines changed

4 files changed

+24
-36
lines changed

example/test.dart

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,23 @@ import 'package:dio/dio.dart';
33

44
main() async {
55
var dio = Dio();
6+
// try {
7+
// await dio.get("https://wendux.github.io/xsddddd");
8+
// print("success");
9+
// } on DioError catch (e) {
10+
// print(e is Error);
11+
// print(e is Exception);
12+
// }
13+
14+
var formData = new FormData.from({
15+
"param1": "-1",
16+
"param2": "-1",
17+
"param3": "-1",
18+
"param4": "-1",
19+
"param5": "-1",
20+
"music": new UploadFileInfo(new File("./example/xx.png"), "audio.m4a"),
21+
});
22+
var t= await formData.asBytesAsync();
23+
print(formData.length==t.length);
624

7-
dio.interceptors.add(InterceptorsWrapper(onError: (e){
8-
print("xxxx");
9-
print(e);
10-
}));
11-
12-
void _testDio() async {
13-
CancelToken token = CancelToken();
14-
var url = "https://github.com/flutterchina12121/dio";
15-
16-
Future.delayed(const Duration(milliseconds: 0), () async {
17-
try {
18-
Response response = await dio.get(url, cancelToken: token);
19-
20-
print("response");
21-
if (response.statusCode == 200) {
22-
print("request success");
23-
} else {
24-
print("request failed");
25-
}
26-
} catch (e) {
27-
28-
print(e);
29-
}
30-
});
31-
32-
Future.delayed(const Duration(milliseconds: 250), () {
33-
print("manual cancel");
34-
if (!token.isCancelled) {
35-
token.cancel();
36-
}
37-
});
38-
}
39-
40-
await _testDio();
4125
}

package_src/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 2.1.5
2+
3+
- fix https://github.com/flutterchina/dio/issues/309
4+
15
# 2.1.4
26

37
- Add `options.responseDecoder`

package_src/lib/src/dio_error.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ enum DioErrorType {
2323
}
2424

2525
/// DioError describes the error info when request failed.
26-
class DioError implements Exception {
26+
class DioError extends Error implements Exception {
2727
DioError({
2828
this.request,
2929
this.response,

package_src/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dio
22
description: A powerful Http client for Dart, which supports Interceptors, FormData, Request Cancellation, File Downloading, Timeout etc.
3-
version: 2.1.4
3+
version: 2.1.5
44
homepage: https://github.com/flutterchina/dio
55
author: wendux <[email protected]>
66

0 commit comments

Comments
 (0)