当使用AWS MultipartUpload上传部分,它如果我添加了MD5标头失败。谁能告诉我,如果我正确地计算校验?
现在,我只是用CryptoSwift
,抓住这样说
data.md5().base64EncodedString()
当数据是什么,我在上传
Alamofire.upload(
data,
to: presignedMultipartLink,
method: Alamofire.HTTPMethod.put,
headers: [
"Content-Length": sizeOfPart,
"Content-MD5": data.md5().base64EncodedString()
])
.uploadProgress{...}
.response{...}
如果我拿出的Content-MD5头它作为期望。
XML响应是,让我怎么加MD5标头?
<Error><Code>AccessDenied</Code><Message>There were headers present in the request which were not signed</Message><HeadersNotSigned>content-md5</HeadersNotSigned><RequestId>requestid</RequestId><HostId>hostid</HostId></Error>
我需要在getPresignedUrl呼叫作为参数去包括。否则不能包括在内。呸......那些日子之一。