HTTP Client
Make HTTP requests with the http plugin.
Supported Platforms
This plugin requires a Rust version of at least 1.77.2
Platform | Level | Notes |
---|---|---|
windows | ||
linux | ||
macos | ||
android | ||
ios |
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 Rust as a reqwest re-export and JavaScript.
JavaScript
-
Configure the allowed URLs
For more information, please see the documentation for Permissions Overview
-
Send a request
The
fetch
method tries to be as close and compliant to thefetch
Web API as possible.
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