How to make post request in swift using alamofire with parameters as below(screenshot from postman)image is file-type, title is text-type
I'm trying sth like this:
let headers = [
"Content-Type": "application/form-data",
"X-App-Token": user.token!
]
Alamofire.upload(multipartFormData:{ multipartFormData in
multipartFormData.append(UIImagePNGRepresentation(imgToSend)!, withName: "image")
multipartFormData.append(titleToSend.data(using: .utf8)!, withName: "title")},
usingThreshold:UInt64.init(),
to: url!,
method:.post,
headers:headers,
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.responseJSON { response in
debugPrint(response)
}
case .failure(let encodingError):
print(encodingError)
}
})
but I got error: [BoringSSL] Function boringssl_session_errorlog: line 2868 [boringssl_session_write] SSL_ERROR_SYSCALL(5): operation failed externally to the library
and (this is weird) debugger goes into .success but when I log response there is error from api