Idiom # 101: Load from HTTP GET request into a string
Code
web.get6 sends a GET request to u
using IPv6 and returns the body of the response.
To connect via IPv4, use web.get4.
The result s is of type outcome String: it is
either the body of the response or an error, e.g., if the
connection fails or the server responds with a status code of 400 or
higher.
Runnable Example
This example cannot be run online since it requires network access.
Module web is not part of the base library, and HTTPS
requires the native TLS library wolfSSL to be installed, so the example
is run as follows:
fz -jvm -modules=web -JLibraries=wolfssl idiom101ex.fz