HTTP Request from inside WASM using quad-net plugin for Miniquad

This example uses quad-net network plugin for Miniquad rendering library or Macroquad game engine, all implemented in Rust.

This demo uses (slightly patched) code from official quad-net example.

See the output in browser developer console.

Actual code:

// Based on https://github.com/not-fl3/quad-net/blob/31796d4ed5c9cce57c7702d18b6140d5ffacfccf/examples/http_request.rs
use macroquad::prelude::*;
use quad_net::http_request::RequestBuilder;

#[macroquad::main("Http request demo")]
async fn main() {
    let mut request = RequestBuilder::new("https://httpbin.org/anything").send();

    loop {
        if let Some(data) = request.try_recv() {
            info!("Done! {}", data.unwrap());
        }
        next_frame().await;
    }
}

Info