T - a Http Response holding a specific type of body.public interface HttpResponse<T>
| Modifier and Type | Method and Description |
|---|---|
T |
getBody() |
Headers |
getHeaders() |
Optional<UnirestParsingException> |
getParsingError()
If the transformation to the body failed by an exception it will be kept here
|
InputStream |
getRawBody()
Deprecated.
this method is redundant and not the original stream. Use the functional asObject methods.
|
int |
getStatus() |
String |
getStatusText() |
HttpResponse<T> |
ifFailure(java.util.function.Consumer<HttpResponse<T>> consumer)
If the response was NOT a 200-series response or a mapping exception happened.
|
HttpResponse<T> |
ifSuccess(java.util.function.Consumer<HttpResponse<T>> consumer)
If the response was a 200-series response.
|
boolean |
isSuccess() |
<V> V |
mapBody(java.util.function.Function<T,V> func) |
<V> V |
mapRawBody(java.util.function.Function<InputStream,V> func)
Deprecated.
|
int getStatus()
String getStatusText()
Headers getHeaders()
getHeaders().getFirst("Location") and not getHeaders().getFirst("location") to get first header "Location"@Deprecated InputStream getRawBody()
T getBody()
Optional<UnirestParsingException> getParsingError()
<V> V mapBody(java.util.function.Function<T,V> func)
V - The return type of the functionfunc - a function to transform a body type to something else.@Deprecated <V> V mapRawBody(java.util.function.Function<InputStream,V> func)
V - the return typefunc - a function to map a inputstream to a new bodyHttpResponse<T> ifSuccess(java.util.function.Consumer<HttpResponse<T>> consumer)
consumer - a function to consume a HttpResponseHttpResponse<T> ifFailure(java.util.function.Consumer<HttpResponse<T>> consumer)
consumer - a function to consume a HttpResponseboolean isSuccess()
Copyright © 2019. All rights reserved.