I\'m using Moya 10.0.1 and I\'m having a problem when I\'m trying to upload an image to the server.
I did follow the Multipart Upload example and this is my setup code:<
var task: Task {
switch self {
case .updateProfilePic(let memberID, let image):
let imageData = UIImageJPEGRepresentation(image, 1.0)
let memberIdData = memberID.data(using: String.Encoding.utf8) ?? Data()
var formData: [Moya.MultipartFormData] = [Moya.MultipartFormData(provider: .data(imageData!), name: "user_img", fileName: "user.jpeg", mimeType: "image/jpeg")]
formData.append(Moya.MultipartFormData(provider: .data(memberIdData), name: "member_id"))
return .uploadMultipart(formData)
}
In Moya multipart request we have to pass parameter as multipartdata form along with it's key name.