Android Flatter dart *****
при попытке загрузить файл резервной копии базы данных SQLite с расширением .db на диск Google для пользователей возникла проблема с кодом ответа об ошибке 411, несмотря на отправку длины содержимого в моем коде.
Я пытался загрузить, используя несколько частей, а также метод суммирования.
Uri uri = Uri.parse(
'https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable HTTP/1.1');
http.MultipartRequest request = new http.MultipartRequest('POST', uri);
if (authService.accessToken == null || authService.accessToken.isEmpty) {
Utils.showToasterMessage('Try logout and login again');
return;
}
request.headers["Authorization"] = 'Bearer ' + authService.accessToken;
request.headers['content-type'] = "application/json; charset=UTF-8";
int lengthInBytes = await file.length();
request.headers['X-Upload-Content-Type'] ='application/x-sqlite-3';
request.headers['X-Upload-Content-Length'] = lengthInBytes.toString();
request.files.add(await http.MultipartFile.fromPath('$fileName', file.path,));
request.headers['content-length'] = (request.contentLength).toString();
http.StreamedResponse response = await request.send();
запрос {Авторизация: Носитель
***************************************, тип контента: multipart / form-data;
граница = дротик-клиент-краевая roT91hs6nPctT.zO41kgWy0OjH_76hml7OU_oWTKv1c5VD-Y.Rm,
X-Upload-Content-Type: application / x-sqlite-3,
X-Upload-Content-Length: 4096, content-length: 4391}
Response {content-type: text/html; charset=UTF-8, date: Sat, 15 Jun 2019 10:37:18 GMT, content-length: 1564, referrer-policy: no-referrer}