This example uses Free Pascal and bjorn3/browser_wasi_shim.
See the output in browser developer console.
Actual code:
function httpGet(url: ShortString; Var str_out:
ShortString): ShortString; external 'wasi_snapshot_preview1';
var out_str : ShortString;
begin
out_str:= DupeString( ' ' , 255 );
httpGet('https://httpbin.org/get', out_str);
writeln(out_str);
end.
Warning This example employs XMLHTTPRequest in synchronous form. Consider making such calls only from inside of Web Workers to avoid UI freezes.