Код: Выделить всё
{
"errorNumber":4,
"status":0,
"message":"G\u00f6nderilen de\u011ferler kontrol edilmeli",
"validate":[
"Daha \u00f6nceden bu email ile kay\u0131t olunmu\u015f. L\u00fctfen giri\u015f yapmay\u0131 deneyiniz."
]
}
Вот мой метод службы Retrofit и объявления данных ответа:
Код: Выделить всё
@FormUrlEncoded
@POST("/Register")
@Headers("Content-Type: application/x-www-form-urlencoded")
Call register(
@Field("fullName") String fullName,
@Field("email") String email,
@Field("password") String password);
public class RegisterResponse {
public int status;
public String message;
public int errorNumber;
public List validate;
}
OkHttpClient client = new OkHttpClient();
client.interceptors().add(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Response response = chain.proceed(chain.request());
final String content = UtilityMethods.convertResponseToString(response);
Log.d(TAG, lastCalledMethodName + " - " + content);
return response.newBuilder().body(ResponseBody.create(response.body().contentType(), content)).build();
}
});
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
domainSearchWebServices = retrofit.create(DomainSearchWebServices.class);
Почему Retrofit не конвертирует мой ответ?
ОБНОВЛЕНИЕ
На данный момент я строю свой ответ на основе тела ошибки.
Подробнее здесь: https://stackoverflow.com/questions/337 ... ponse-body