This module provides http client functions on JVM and JS.
The downsides of ceylon.net.http.client:
Currently only support GET:
switch (result = get("https://example.com"))
case (is String) {
print("response: status 200, body: ``result``");
}
case (is Integer) {
print("response: status ``result``");
}
It also provides common request exceptions.
| Packages | |
| io.github.weakish.request | |
| Dependencies | ||
ceylon.http.client | 1.3.0 | |
ceylon.test | 1.3.0 | |
ceylon.uri | 1.3.0 | |
| Functions | |
get | shared String|Integer get(String url)Given a Url String, returns GET Response content when success (200), otherwise returns status code. |
try_get | shared String try_get(String url, Nothing(String) handle_404 = ...) |
| Exceptions | |
ConnectionError | shared ConnectionErrorNetwork problems such as DNS failure and not connected. |
HttpError | shared HttpErrorThrown if the HTTP request returned an unsuccessful status code. Generally 2xx are sucessful, but your application may have a different meaning of 'success'. |
RequestException | shared RequestExceptionRoot exception. |
TimeoutError | shared TimeoutErrorThrown if a request times out. |
TooManyRedirectsError | shared TooManyRedirectsErrorThrown if specified number of maximum redirections exceeded. |