Skip to content

Commit

Permalink
support OnUploadProgress
Browse files Browse the repository at this point in the history
  • Loading branch information
duwen committed Feb 12, 2019
1 parent 0778fd2 commit 94e439a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/src/dio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Dio {
}

/// The Dio version.
static const version = "1.0.16";
static const version = "1.0.17";

/// Default Request config. More see [Options] .
Options options;
Expand Down Expand Up @@ -501,6 +501,7 @@ class Dio {
Future<Response<T>> future =
_checkIfNeedEnqueue<T>(interceptor.request, () {
_mergeOptions(options);
options.data = data;
options.path = path;
// If user provide a request interceptor, enter the interceptor.
InterceptorCallback preSend = interceptor.request.onSend;
Expand Down Expand Up @@ -820,7 +821,6 @@ class Dio {
opt.connectTimeout ??= options.connectTimeout ?? 0;
opt.receiveTimeout ??= options.receiveTimeout ?? 0;
opt.responseType ??= options.responseType ?? ResponseType.JSON;
opt.data ??= options.data;
opt.extra = (new Map.from(options.extra))..addAll(opt.extra);
opt.contentType ??= options.contentType ?? ContentType.json;
opt.validateStatus ??= options.validateStatus ??
Expand Down
3 changes: 2 additions & 1 deletion lib/src/form_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class FormData extends MapMixin<String, dynamic> {
}
_appendTextField(data, key, value, bytes);
});
//int length=bytes.length;
fileMap.forEach((key, fileInfo) {
if(fileInfo is UploadFileInfo) {
_appendFileContent(data,key, fileInfo, bytes);
Expand All @@ -92,11 +93,11 @@ class FormData extends MapMixin<String, dynamic> {
});
}
});

if (_map.length > 0 || fileMap.length > 0) {
data.clear();
data.write(boundary+"--");
_writeln(data);
//_writeln(data);
bytes.addAll(utf8.encode(data.toString()));
}
return bytes;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dio
description: A powerful Http client for Dart, which supports Interceptors, FormData, Request Cancellation, File Downloading, Timeout etc.
version: 1.0.16
version: 1.0.17
homepage: https://github.com/flutterchina/dio
author: wendux <824783146@qq.com>

Expand Down

0 comments on commit 94e439a

Please sign in to comment.