我尝试在颤振中使用 MultipartRequest 将文件上传到 s3,但是在到达“response.send()”时我得到了
I/flutter ( 8307): HandshakeException: Handshake error in client (OS Error:
I/flutter ( 8307): CERTIFICATE_VERIFY_FAILED: self signed certificate in certificate chain(handshake.cc:354))
我在 Postman 中关闭了“SSL 证书验证”以使其正常工作,那么有什么方法可以在上传时将其关闭吗?
这是我使用的代码:
var request = http.MultipartRequest('POST', uri)
..fields['key'] = data.key
..fields['x-amz-algorithm'] = data.algorithm
..fields['x-amz-credential'] = data.credential
..fields['x-amz-date'] = data.date
..fields['x-amz-security-token'] = data.securityToken
..fields['policy'] = data.policy
..files.add(await http.MultipartFile.fromPath('File', imagePath, filename: imageName));
print(request.toString());
try {
var response = await request.send();
await for (var value in response.stream.transform(utf8.decoder)) {
print(value);
}
} catch (e) {
print(e.toString());
}