ios - 404 error when uploading nultipart form data with parameters -


i trying upload images parameters multipart form data in moya. have following api:

enum apiservice {     case upload(body:[string: string]?, profilephoto: data, frontidphoto: data, backidphoto: data)  }  extension apiservice: targettype {      var baseurl: url {        return url(string: "http://202.166.194.122:8787/api/")!     }      var path: string {         switch self {         case .upload:             return "jsonrx/updatecustomerkyc/"         }     }      var method: moya.method {         switch self {         case .upload:             return .post         }     }      var parameters: [string: any]? {         switch self {         case .upload(let body, _, _, _):             return body [string: any]?         }     }      var parameterencoding: parameterencoding {             return urlencoding.default         }     }      var task: task {         switch self {         case .upload(_, let profilephoto,let frontidphoto, let backidphoto):             var formdata: [multipartformdata] = []                         let profilepic = multipartformdata(provider: .data(profilephoto), name: "profileimage", filename: "profileimage.png", mimetype: "image/png")             let frontphoto = multipartformdata(provider: .data(frontidphoto), name: "frontidimage", filename: "frontimage.png", mimetype: "image/png")             let backphoto = multipartformdata(provider: .data(backidphoto), name: "backidimage", filename: "backimage.png", mimetype: "image/png")             formdata.append(profilepic)             formdata.append(frontphoto)             formdata.append(backphoto)             return .upload(.multipart(formdata))         }     }      var sampledata: data {        return data()     }      var validate: bool {        return true     } 

however, response status code gives 404, working fine in postman.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -