newShare method
Implementation
Future<Uint8List> newShare(String rootShortlink, Uint8List katamari) async {
var url = Uri.parse(uri + '/share/' + rootShortlink + '?bin=true');
try {
var response = await http.post(url, body: {
'katamari': base64Encode(katamari),
}, headers: {
'Cookie': 'DARTSESSID=' + dartSessionId
}).timeout(_timoutIn);
if (response == null) return Uint8List(0);
//504 gateway tim out!
if (response.statusCode != 200) return Uint8List(0);
print('Response status: ${response.statusCode}');
String? h = response.headers["set-cookie"];
if (h != null) {
cookie = h.split(' ').first;
String dSid = cookie.split('=').last;
dartSessionId = dSid.substring(0, dSid.length - 1);
}
return response.bodyBytes;
} catch (e) {
print('Future<Uint8List> newShare httpconnector ERROR');
print(e);
if (!(e is TimeoutException)) setOffline();
return Uint8List(0);
}
}