diff --git a/.changes/correct-http-api-types.md b/.changes/correct-http-api-types.md new file mode 100644 index 000000000..eac77e2c9 --- /dev/null +++ b/.changes/correct-http-api-types.md @@ -0,0 +1,5 @@ +--- +"tauri-api": patch +--- + +Align HTTP API types with the [documentation](https://tauri.studio/en/docs/api/js#http). diff --git a/api/src/http.ts b/api/src/http.ts index 5c65dfce7..a6ca6536f 100644 --- a/api/src/http.ts +++ b/api/src/http.ts @@ -1,7 +1,7 @@ import { invokeTauriCommand } from './helpers/tauri' export interface ClientOptions { - maxRedirections: boolean + maxRedirections: number connectTimeout: number } @@ -115,7 +115,7 @@ export class Client { * * @return promise resolving to the response */ - async get(url: string, options: RequestOptions): Promise> { + async get(url: string, options?: RequestOptions): Promise> { return this.request({ method: 'GET', url, @@ -134,8 +134,8 @@ export class Client { */ async post( url: string, - body: Body, - options: RequestOptions + body?: Body, + options?: RequestOptions ): Promise> { return this.request({ method: 'POST', @@ -156,8 +156,8 @@ export class Client { */ async put( url: string, - body: Body, - options: RequestOptions + body?: Body, + options?: RequestOptions ): Promise> { return this.request({ method: 'PUT', @@ -175,7 +175,7 @@ export class Client { * * @return promise resolving to the response */ - async patch(url: string, options: RequestOptions): Promise> { + async patch(url: string, options?: RequestOptions): Promise> { return this.request({ method: 'PATCH', url, @@ -191,7 +191,7 @@ export class Client { * * @return promise resolving to the response */ - async delete(url: string, options: RequestOptions): Promise> { + async delete(url: string, options?: RequestOptions): Promise> { return this.request({ method: 'DELETE', url,