Retrofit2 - 是否可以循环@Part of retrofit?
Retrofit2 - Is possible to loop @Part of retrofit?
我有改造问题,后端只能使用@Mutilpart,我尝试使用@PartMap map: HashMap 但还是不行。可能循环或其他解决方案请帮助。
@Multipart
@POST("orders/total")
suspend fun orderList(
@Part("Order[0][product_id]") product_id: RequestBody ,
@Part("Order[0][quantity_id]") quantity_id: RequestBody ,
@Part("Order[1][product_id]") product_id2: RequestBody ,
@Part("Order[1][quantity_id]") quantity_id2: RequestBody ,
): Response<OrderModel>
尝试发送列表
@Part List<MultipartBody.Part> products
我有改造问题,后端只能使用@Mutilpart,我尝试使用@PartMap map: HashMap
@Multipart
@POST("orders/total")
suspend fun orderList(
@Part("Order[0][product_id]") product_id: RequestBody ,
@Part("Order[0][quantity_id]") quantity_id: RequestBody ,
@Part("Order[1][product_id]") product_id2: RequestBody ,
@Part("Order[1][quantity_id]") quantity_id2: RequestBody ,
): Response<OrderModel>
尝试发送列表
@Part List<MultipartBody.Part> products