HTTP Request from inside WASM using System.Net.Http.HttpClient

This example uses System.Net.Http.HttpClient from standard library.

See the output in browser developer console.

Actual code:


using System;
using System.Net.Http;

HttpClient client = new HttpClient();
string uri = "https://httpbin.org/anything";
string responseText = await client.GetStringAsync(uri);

Console.WriteLine("body: " + responseText);

Info