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.Respons
ErrorResponse is your custom response object
Kotlin
val gson = Gson()
val type = object : TypeToken() {}.type
var errorResponse: ErrorResponse? = gson.fromJson(response.errorBody()!!.charStream(), type)
Java
Gson gson = new Gson();
Type type = new TypeToken() {}.getType();
ErrorResponse errorResponse = gson.fromJson(response.errorBody.charStream(),type);