mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
chore: update documentation
This commit is contained in:
@@ -48,6 +48,11 @@ export interface Proxy {
|
||||
https?: string | ProxyConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* Detailed configuration of a single proxy server, used when a plain URL string is not enough.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export interface ProxyConfig {
|
||||
/**
|
||||
* The URL of the proxy server.
|
||||
@@ -57,7 +62,13 @@ export interface ProxyConfig {
|
||||
* Set the `Proxy-Authorization` header using Basic auth.
|
||||
*/
|
||||
basicAuth?: {
|
||||
/**
|
||||
* The user name sent to the proxy server.
|
||||
*/
|
||||
username: string
|
||||
/**
|
||||
* The password sent to the proxy server.
|
||||
*/
|
||||
password: string
|
||||
}
|
||||
/**
|
||||
@@ -116,14 +127,24 @@ const ERROR_REQUEST_CANCELLED = 'Request cancelled'
|
||||
* Fetch a resource from the network. It returns a `Promise` that resolves to the
|
||||
* `Response` to that `Request`, whether it is successful or not.
|
||||
*
|
||||
* The request is performed by the Rust backend instead of the webview, so it is not subject to
|
||||
* CORS, but the URL must be allowed by the plugin scope.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { fetch } from '@tauri-apps/plugin-http';
|
||||
* const response = await fetch("http://my.json.host/data.json");
|
||||
* console.log(response.status); // e.g. 200
|
||||
* console.log(response.statusText); // e.g. "OK"
|
||||
* const jsonData = await response.json();
|
||||
* ```
|
||||
*
|
||||
* @param input The resource to fetch, as a URL, a string or a `Request` object.
|
||||
* @param init The standard `fetch` request options, extended with the Rust client options from
|
||||
* {@linkcode ClientOptions}: `maxRedirections`, `connectTimeout`, `proxy` and `danger`. The
|
||||
* `signal` option can be used to abort the request.
|
||||
* @returns A promise resolving to the `Response` of the request.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
export async function fetch(
|
||||
|
||||
Reference in New Issue
Block a user