HTTP client
Run the HTTP server in another terminal. Save this program as http-client.atom and run atom run http-client.atom -- 18080. The optional argument selects a matching loopback port.
use http
use os
port = convert(i64, get(os.args, 0, '18080'))
response = http.request({
url = 'http://127.0.0.1:{port}/greet'
query = {name = 'Ada'}
headers = {accept = 'text/plain'}
timeout = 5
})
assert(response.status == 200)
print(response.body)