Make HTTP requests with the http plugin.
Install the http plugin to get started.
Use your project’s package manager to add the dependency:
-
Run cargo add tauri-plugin-http
to add the plugin to the project’s dependencies in Cargo.toml
.
-
Modify lib.rs
to initialize the plugin:
-
If you’d like to make http requests in JavaScript then install the npm package as well:
The http plugin is available in both as an JavaScript API and in Rust as a reqwest re-export.
-
Configure the allowed URLs
For more information, please see the documentation for Access Control Lists
-
Send a request
In Rust you can utilize the reqwest
crate re-exported by the plugin. For more details refer to reqwest docs.
© 2024 Tauri Contributors. CC-BY / MIT