// Example 42: HTTP Client
// Demonstrates making HTTP requests with Windjammer's std.http abstraction
use std::http
@async
fn fetch_data() {
println!("Fetching data from httpbin.org...")
let url = "https://httpbin.org/get"
// Use Windjammer's http abstraction - no direct reqwest access!
let result = http.get(url).await
match result {
Ok(response) => {
let status = response.status_code()
println!("Status: {}", status)
println!("Request successful!")
}
Err(e) => println!("Error: {}", e)
}
}
@async
fn main() {
println!("=== HTTP Client Demo ===")
println!()
fetch_data().await
println!()
println!("✨ HTTP client with Windjammer!")
println!(" ✅ Using std.http abstraction (not reqwest directly)")
println!(" ✅ Dependencies added automatically")
println!(" ✅ Clean, Windjammer-native API")
}