http.get('https://api.example.com/data', { timeout = 5 }, function(r)
if r.status == 200 then
local data = json.decode(r.body)
print(data.result)
end
end)
http.post('https://api.example.com/log', json.encode({ event = 'loaded' }), {
headers = { ['Content-Type'] = 'application/json' }
}, function(r)
print('posted:', r.status)
end)