Multipart Request using Retrofit 1.8.0 not working

前端 未结 3 1012
名媛妹妹
名媛妹妹 2021-01-12 19:25

I have like 4 days, trying to make a Multipart Request using Retrofit 1.8.0 in android with any success. My interface looks something like this

@Multipart
@         


        
3条回答
  •  说谎
    说谎 (楼主)
    2021-01-12 20:25

    If you see the examples on http://square.github.io/retrofit/ the object types for your "id" and "part[body]" parameters need to be TypedString and not String. TypedString sets the appropriate MIME type and does the conversion to bytes:

    https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit/mime/TypedString.java

提交回复
热议问题