Skip to content

Commit 2fc39fc

Browse files
authored
fix(api/http): correct types (#1360)
* fix(api/http): correct types * Add changes * Update correct-http-api-types.md
1 parent 4ee044a commit 2fc39fc

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.changes/correct-http-api-types.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-api": patch
3+
---
4+
5+
Align HTTP API types with the [documentation](https://tauri.studio/en/docs/api/js#http).

api/src/http.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { invokeTauriCommand } from './helpers/tauri'
22

33
export interface ClientOptions {
4-
maxRedirections: boolean
4+
maxRedirections: number
55
connectTimeout: number
66
}
77

@@ -115,7 +115,7 @@ export class Client {
115115
*
116116
* @return promise resolving to the response
117117
*/
118-
async get<T>(url: string, options: RequestOptions): Promise<Response<T>> {
118+
async get<T>(url: string, options?: RequestOptions): Promise<Response<T>> {
119119
return this.request({
120120
method: 'GET',
121121
url,
@@ -134,8 +134,8 @@ export class Client {
134134
*/
135135
async post<T>(
136136
url: string,
137-
body: Body,
138-
options: RequestOptions
137+
body?: Body,
138+
options?: RequestOptions
139139
): Promise<Response<T>> {
140140
return this.request({
141141
method: 'POST',
@@ -156,8 +156,8 @@ export class Client {
156156
*/
157157
async put<T>(
158158
url: string,
159-
body: Body,
160-
options: RequestOptions
159+
body?: Body,
160+
options?: RequestOptions
161161
): Promise<Response<T>> {
162162
return this.request({
163163
method: 'PUT',
@@ -175,7 +175,7 @@ export class Client {
175175
*
176176
* @return promise resolving to the response
177177
*/
178-
async patch<T>(url: string, options: RequestOptions): Promise<Response<T>> {
178+
async patch<T>(url: string, options?: RequestOptions): Promise<Response<T>> {
179179
return this.request({
180180
method: 'PATCH',
181181
url,
@@ -191,7 +191,7 @@ export class Client {
191191
*
192192
* @return promise resolving to the response
193193
*/
194-
async delete<T>(url: string, options: RequestOptions): Promise<Response<T>> {
194+
async delete<T>(url: string, options?: RequestOptions): Promise<Response<T>> {
195195
return this.request({
196196
method: 'DELETE',
197197
url,

0 commit comments

Comments
 (0)