Android在使用Retrofit上传文件时,前台上传成功,后台报错
而postman上传成功,抓包对比数据后发现,postman的头数据里有boundary这个字段
将boundary=<calculated when request is sent>加入Android接口
上传成功!
//上传文件
@Multipart
@Headers("Content-Type:multipart/form-data; boundary=<calculated when request is sent>")
@POST("/admin/miniapp/api/upload/{fileType}/{id}")
Call<UpLoadSuccess> upload(@Path("fileType") String fileType, @Path("id") String id, @Part MultipartBody.Part file);