如何正确使用ActiveRecord
的PUT方法?在Postman中一切正常,但在Android App中它并没有。
我的界面:
x-www-form-urlencoded
工厂类:
@FormUrlEncoded
@PUT(ApiConstants.REGISTER_URL_PART)
Call<RegisterModel> getStatus(
@Field("username") String username,
@Field("email") String email,
@Field("password") String password,
@Field("fbID") String fbID,
@Field("gmailID") String gmailID,
@Field("twitID") String twitID,
@Field("gender") String gender,
@Field("birthDate") String birthDate,
@Field("location") String location,
@Field("longitude") String longitude,
@Field("latitude") String latitude,
@Field("profileImage") String profileImage
);
请求示例:
class Factory {
private static AuthRegisterUserApi service;
public static AuthRegisterUserApi getInstance() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(ApiConstants.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
service = retrofit.create(AuthRegisterUserApi.class);
return service;
}
}
在应用程序中抛出代码400或500 ...知道如何在我的应用程序中核心实现此PUT方法吗?