所有请求方法都正常,但PUT请求方法永远不会成功。它在'Postman'中完美地工作,具有相同的参数。我的请求调用接口
@Multipart
@PUT("api/v1/user/{id}/")
Call<UpdateProfileResponse> updateUserProfile(
@Header("Authorization") String token,
@Path("id") int user_id,
@Part("name") RequestBody name,
@Part("email") RequestBody email,
@Part("password") RequestBody password,
@Part MultipartBody.Part picture,
@Part("city") RequestBody city,
@Part("country") RequestBody country,
@Part("bank_name") RequestBody bank_name,
@Part("bank_account_name") RequestBody bank_account_name,
@Part("bank_account_number") RequestBody bank_account_number,
@Part("user_type") RequestBody user_type,
@Part("address") RequestBody address
);
请求呼叫(入队)
mApiClient.updateUserProfile(access_token, user_id, name, email, password, bodyPicture, city,
country, bank_name, bank_account_name, bank_account_number, user_type, address)
.enqueue(new Callback<UpdateProfileResponse>() {
@Override
public void onResponse(Call<UpdateProfileResponse> call, Response<UpdateProfileResponse> response) {
if (response.isSuccessful()) {
Log.d(TAG, "update response: " + response.body().toString());
} else {
Log.d(TAG, "update response: " + response.errorBody());
}
}
@Override
public void onFailure(Call<UpdateProfileResponse> call, Throwable t) {
t.printStackTrace();
}
});
它总是在OnResponse else块中完成(不成功)。没有任何线索我做错了什么。需要建议解决这个问题。