Access the HTTP client written in Rust.
This package is also accessible with window.__TAURI__.http
when tauri.conf.json > build > withGlobalTauri
is set to true.
The APIs must be allowlisted on tauri.conf.json
:
{
"tauri": {
"allowlist": {
"http": {
"all": true, // enable all http APIs
"request": true // enable HTTP request API
}
}
}
}
It is recommended to allowlist only the APIs you use for optimal bundle size and security.
#
Enumerations#
Classes#
Interfaces#
Type aliases#
FetchOptionsƬ FetchOptions: Omit
<HttpOptions
, "url"
>
Options for the fetch
API.
#
Defined in#
HttpVerbƬ HttpVerb: "GET"
| "POST"
| "PUT"
| "DELETE"
| "PATCH"
| "HEAD"
| "OPTIONS"
| "CONNECT"
| "TRACE"
The request HTTP verb.
#
Defined in#
PartƬ Part: "string"
| number
[]
#
Defined in#
RequestOptionsƬ RequestOptions: Omit
<HttpOptions
, "method"
| "url"
>
Request options.
#
Defined in#
Functions#
fetch▸ fetch<T
>(url
, options?
): Promise
<Response
<T
>>
Perform an HTTP request using the default client.
#
Type parametersName |
---|
T |
#
ParametersName | Type | Description |
---|---|---|
url | string | The request URL. |
options? | FetchOptions | The fetch options. |
#
ReturnsPromise
<Response
<T
>>
The response object.
#
Defined in#
getClient▸ getClient(options?
): Promise
<Client
>
Creates a new client using the specified options.
#
ParametersName | Type | Description |
---|---|---|
options? | ClientOptions | Client configuration. |
#
ReturnsPromise
<Client
>
A promise resolving to the client instance.