HTTP Client
Make HTTP requests with the http plugin.
Setup
Install the http plugin to get started.
Use your project’s package manager to add the dependency:
-
Run the following command in the
src-tauri
folder to add the plugin to the project’s dependencies inCargo.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:
Usage
The http plugin is available in both as an JavaScript API and in Rust as a reqwest re-export.
JavaScript
-
Configure the allowed URLs
For more information, please see the documentation for Permissions Overview
-
Send a request
Rust
In Rust you can utilize the reqwest
crate re-exported by the plugin. For more details refer to reqwest docs.
Default Permission
This permission set configures what kind of fetch operations are available from the http plugin.
This enables all fetch operations but does not allow explicitly any origins to be fetched. This needs to be manually configured before usage.
Granted Permissions
All fetch operations are enabled.
allow-fetch
allow-fetch-cancel
allow-fetch-read-body
allow-fetch-send
Permission Table
Identifier | Description |
---|---|
|
Enables the fetch command without any pre-configured scope. |
|
Denies the fetch command without any pre-configured scope. |
|
Enables the fetch_cancel command without any pre-configured scope. |
|
Denies the fetch_cancel command without any pre-configured scope. |
|
Enables the fetch_read_body command without any pre-configured scope. |
|
Denies the fetch_read_body command without any pre-configured scope. |
|
Enables the fetch_send command without any pre-configured scope. |
|
Denies the fetch_send command without any pre-configured scope. |
© 2024 Tauri Contributors. CC-BY / MIT