【发布时间】:2016-02-15 01:44:21
【问题描述】:
我在向服务器发送 multipartRequest 时遇到问题。
RequestBody file = RequestBody.create(MediaType.parse("application/json"), myFile);
return apiService.updateProfile2(token, file);
@Multipart
@POST("/profile/update")
Call<RegistrationResponse> updateProfile2(@Header(value = "X-AUTH-TOKEN") String toke, @Part(value = "json") RequestBody json);
问题:
请求体是空的,当它来到服务器时
【问题讨论】:
-
你试过
TypedFile吗? -
@RethinavelPillai 在 Retrofit 2.0 中没有 TypedFile
-
retrofit:2.0.0-beta1 不支持 TypedFile =(
-
可以发一下请求代码吗?
-
@Anderson C Silva 你的意思是这个 Call
call = dataProvider.requestUpdateProfile2(token, new File(path));
标签: java android http retrofit multipartform-data