1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Updated Dio

This commit is contained in:
2020-03-24 15:01:34 +01:00
parent 13394811bb
commit 6e867041e8
3 changed files with 11 additions and 13 deletions

View File

@ -37,12 +37,17 @@ class APIHelper {
else
url = Uri.https(config().apiServerName, path);
final data = FormData.from(request.args);
final data = FormData.fromMap(request.args);
// Process files (if required)
if (multipart)
request.files.forEach(
(k, v) => data.add(k, UploadFileInfo(v, v.path.split("/").last)));
for (var key in request.files.keys) {
var v = request.files[key];
data.files.add(MapEntry(
key,
await MultipartFile.fromFile(v.path,
filename: v.path.split("/").last)));
}
// Execute the request
final response = await Dio().post(