mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
[MSA] (2/?) Bug fix: ClassCastException
This commit is contained in:
parent
4bd35a10be
commit
9a8e961795
@ -25,8 +25,14 @@ public class HttpResponse<T>
|
||||
}
|
||||
|
||||
public T body() throws IOException {
|
||||
Class<T> type = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
|
||||
if (type.isAssignableFrom(String.class)) {
|
||||
if (statusCode() >= 200 && statusCode() < 300) {
|
||||
return (T) Tools.read(mRequest.mBuilder.getBase().getInputStream());
|
||||
} else {
|
||||
return (T) Tools.read(mRequest.mBuilder.getBase().getErrorStream());
|
||||
}
|
||||
|
||||
/*
|
||||
if (T instanceof String) {
|
||||
if (statusCode() >= 200 && statusCode() < 300) {
|
||||
return (T) Tools.read(mRequest.mBuilder.getBase().getInputStream());
|
||||
} else {
|
||||
@ -35,5 +41,6 @@ public class HttpResponse<T>
|
||||
} else {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user