I was trying to send string and images with a retrofit.
while I could get pass response with x-www-form-urlencoded & hashmap, but I need to send it with the image. so I use form-data, but I couldn't get the same response with the same name and value, tested it on postman and it goes passed the same as my x-www-form.
so here is the postman Postman request that got pass response
Method that doesn't goes through with form-data
@Multipart
@POST("report")
fun push(
@HeaderMap headers: Map<String, String>,
@Part("store") string: RequestBody
): Call<ReportingResponse>
RequestBody.create(MediaType.parse("multipart/form-data"), "testing") //#1 fail
RequestBody.create(MediaType.parse("text/plain"), "testing") //#2 fail
I tried both but couldn't get the same response as the postman, and what it looks is just like this Retrofit request interceptor on Android Studio
Method that goes Through with x-www-form
@FormUrlEncoded
@POST("report")
fun push(
@HeaderMap headers: Map<String, String>,
@FieldMap form: MutableMap<String, Any>
): Call<ReportingResponse>
What am I suppose to do?