Issue
I'm using Retrofit 2.0.0-beta1.
In tests i have an alternate scenario and expect error HTTP 400
I would like to have retrofit.Response<MyError> response
but response.body() == null
MyError is not deserialised - i see it only here
response.errorBody().string()
but it doesn't give me MyError as object
Solution
solved it by:
Converter<MyError> converter =
(Converter<MyError>)JacksonConverterFactory.create().get(MyError.class);
MyError myError = converter.fromBody(response.errorBody());
Answered By - Piotr Boho
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.