Пример #1
0
 public static RetrofitError httpError(
     String url,
     rapid.rest.client.Response response,
     rapid.rest.converter.Converter converter,
     Type successType) {
   String message = response.getStatus() + " " + response.getReason();
   return new RetrofitError(message, url, response, converter, successType, false, null);
 }
Пример #2
0
 /**
  * HTTP response body converted to specified {@code type}. {@code null} if there is no response.
  */
 public Object getBodyAs(Type type) {
   if (response == null) {
     return null;
   }
   rapid.rest.mime.TypedInput body = response.getBody();
   if (body == null) {
     return null;
   }
   try {
     return converter.fromBody(body, type);
   } catch (rapid.rest.converter.ConversionException e) {
     throw new RuntimeException(e);
   }
 }