-
public final class HttpClientKt
-
-
Method Summary
Modifier and Type Method Description final static Try<HttpFetchResponse, HttpError>fetch(HttpClient $self, HttpRequest request)Fetches the resource from the given request. final static <T extends Any> Try<T, HttpError>fetchWithDecoder(HttpClient $self, HttpRequest request, Function1<HttpFetchResponse, T> decoder)Fetches the resource from the given request before decoding it with the provided decoder. final static Try<String, HttpError>fetchString(HttpClient $self, HttpRequest request, Charset charset)Fetches the resource from the given request as a String. final static Try<JSONObject, HttpError>fetchJSONObject(HttpClient $self, HttpRequest request)Fetches the resource from the given request as a JSONObject. final static Try<HttpResponse, HttpError>head(HttpClient $self, HttpRequest request)Performs a HEAD request to retrieve only the response headers. -
-
Method Detail
-
fetch
final static Try<HttpFetchResponse, HttpError> fetch(HttpClient $self, HttpRequest request)
Fetches the resource from the given request.
-
fetchWithDecoder
final static <T extends Any> Try<T, HttpError> fetchWithDecoder(HttpClient $self, HttpRequest request, Function1<HttpFetchResponse, T> decoder)
Fetches the resource from the given request before decoding it with the provided decoder.
If the decoder fails, a MalformedResponse error is returned.
-
fetchString
final static Try<String, HttpError> fetchString(HttpClient $self, HttpRequest request, Charset charset)
Fetches the resource from the given request as a String.
-
fetchJSONObject
final static Try<JSONObject, HttpError> fetchJSONObject(HttpClient $self, HttpRequest request)
Fetches the resource from the given request as a JSONObject.
-
head
final static Try<HttpResponse, HttpError> head(HttpClient $self, HttpRequest request)
Performs a HEAD request to retrieve only the response headers.
This helpers falls back on a GET request with 0-length byte range if the server doesn't support HEAD requests.
-
-
-
-