oss表单直传,The body of your POST request is not well-formed multipart/form-data
private func contentHeaders(withName name: String, fileName: String? = nil, mimeType: String? = nil) -> [String: String] {
var disposition = 'form-data; name=\'\(name)\''
if let fileName = fileName { disposition += '; filename=\'\(fileName)\'' }
var headers = ['Content-Disposition': disposition]
// if let mimeType = mimeType { headers['Content-Type'] = mimeType }
return headers
}
我是直接修改源代码,把if let mimeType = mimeType { headers['Content-Type'] = mimeType }这行注释掉
我是直接修改源代码,把 contentHeaders 方法里的 if let mimeType = mimeType { headers['Content-Type'] = mimeType } 这行注释掉
private func contentHeaders(withName name: String, fileName: String? = nil, mimeType: String? = nil) -> [String: String] {
var disposition = 'form-data; name=\'\(name)\''
if let fileName = fileName { disposition += '; filename=\'\(fileName)\'' }
var headers = ['Content-Disposition': disposition]
// if let mimeType = mimeType { headers['Content-Type'] = mimeType }
return headers
}
赞0
踩0