Skip to content

Commit 94e439a

Browse files
author
duwen
committed
support OnUploadProgress
1 parent 0778fd2 commit 94e439a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/src/dio.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Dio {
4343
}
4444

4545
/// The Dio version.
46-
static const version = "1.0.16";
46+
static const version = "1.0.17";
4747

4848
/// Default Request config. More see [Options] .
4949
Options options;
@@ -501,6 +501,7 @@ class Dio {
501501
Future<Response<T>> future =
502502
_checkIfNeedEnqueue<T>(interceptor.request, () {
503503
_mergeOptions(options);
504+
options.data = data;
504505
options.path = path;
505506
// If user provide a request interceptor, enter the interceptor.
506507
InterceptorCallback preSend = interceptor.request.onSend;
@@ -820,7 +821,6 @@ class Dio {
820821
opt.connectTimeout ??= options.connectTimeout ?? 0;
821822
opt.receiveTimeout ??= options.receiveTimeout ?? 0;
822823
opt.responseType ??= options.responseType ?? ResponseType.JSON;
823-
opt.data ??= options.data;
824824
opt.extra = (new Map.from(options.extra))..addAll(opt.extra);
825825
opt.contentType ??= options.contentType ?? ContentType.json;
826826
opt.validateStatus ??= options.validateStatus ??

lib/src/form_data.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class FormData extends MapMixin<String, dynamic> {
7979
}
8080
_appendTextField(data, key, value, bytes);
8181
});
82+
//int length=bytes.length;
8283
fileMap.forEach((key, fileInfo) {
8384
if(fileInfo is UploadFileInfo) {
8485
_appendFileContent(data,key, fileInfo, bytes);
@@ -92,11 +93,11 @@ class FormData extends MapMixin<String, dynamic> {
9293
});
9394
}
9495
});
96+
9597
if (_map.length > 0 || fileMap.length > 0) {
9698
data.clear();
9799
data.write(boundary+"--");
98100
_writeln(data);
99-
//_writeln(data);
100101
bytes.addAll(utf8.encode(data.toString()));
101102
}
102103
return bytes;

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: 1.0.16
3+
version: 1.0.17
44
homepage: https://github.com/flutterchina/dio
55
author: wendux <[email protected]>
66

0 commit comments

Comments
 (0)