Android retrofit rxjava图文混传

参考:https://blog.csdn.net/soslinken/article/details/51274327

/**
 * 修改头像
 *
 * @return
 */
@Multipart
@POST("/health/app")
Observable<HttpResult<MemberInfo>> ModifyAvator(@Part("imgFile\"; filename=\"avatar.png\"") RequestBody file
                                               ,@Part("rq") RequestBody rq
                                              ,@Part("memberId") RequestBody memberId);
//创建RequwstBody对象
RequestBody requestBody = RequestBody.create(MediaType.parse("image/*"), file);
//创建nickNameBody对象
RequestBody rq = RequestBody.create(MediaType.parse("text/plain"), "/app/updateMember");
RequestBody requestBody1 = RequestBody.create(MediaType.parse("text/plain"), SPUtil.getString(SpKey.USER_ID));
Observable observable = Http.getDefault().ModifyAvator(requestBody,rq,requestBody1);

阅读更多

没有更多推荐了,返回首页