Available on crate feature
remote-asset only.Expand description
HTTP requests with the remote-asset feature enabled.
use freya_components::{
Url,
http,
};
let url = Url::parse("https://example.com")?;
let bytes = http::fetch(url).await?;Native requests use a default client unless you provide one at launch:
fn main() -> Result<(), reqwest::Error> {
let client = reqwest::blocking::Client::builder()
.user_agent("MyApp/1.0")
.build()?;
launch(
LaunchConfig::new()
.with_global_context(client)
.with_window(WindowConfig::new(app)),
);
Ok(())
}On web, requests use the browser and follow its CORS rules.
Functionsยง
- fetch
Non-Emscripten - Fetches
urlusing the app-wide HTTP client on native platforms.