mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
fix(api/http): correct types (#1360)
* fix(api/http): correct types * Add changes * Update correct-http-api-types.md
This commit is contained in:
5
.changes/correct-http-api-types.md
Normal file
5
.changes/correct-http-api-types.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-api": patch
|
||||
---
|
||||
|
||||
Align HTTP API types with the [documentation](https://tauri.studio/en/docs/api/js#http).
|
||||
@@ -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<T>(url: string, options: RequestOptions): Promise<Response<T>> {
|
||||
async get<T>(url: string, options?: RequestOptions): Promise<Response<T>> {
|
||||
return this.request({
|
||||
method: 'GET',
|
||||
url,
|
||||
@@ -134,8 +134,8 @@ export class Client {
|
||||
*/
|
||||
async post<T>(
|
||||
url: string,
|
||||
body: Body,
|
||||
options: RequestOptions
|
||||
body?: Body,
|
||||
options?: RequestOptions
|
||||
): Promise<Response<T>> {
|
||||
return this.request({
|
||||
method: 'POST',
|
||||
@@ -156,8 +156,8 @@ export class Client {
|
||||
*/
|
||||
async put<T>(
|
||||
url: string,
|
||||
body: Body,
|
||||
options: RequestOptions
|
||||
body?: Body,
|
||||
options?: RequestOptions
|
||||
): Promise<Response<T>> {
|
||||
return this.request({
|
||||
method: 'PUT',
|
||||
@@ -175,7 +175,7 @@ export class Client {
|
||||
*
|
||||
* @return promise resolving to the response
|
||||
*/
|
||||
async patch<T>(url: string, options: RequestOptions): Promise<Response<T>> {
|
||||
async patch<T>(url: string, options?: RequestOptions): Promise<Response<T>> {
|
||||
return this.request({
|
||||
method: 'PATCH',
|
||||
url,
|
||||
@@ -191,7 +191,7 @@ export class Client {
|
||||
*
|
||||
* @return promise resolving to the response
|
||||
*/
|
||||
async delete<T>(url: string, options: RequestOptions): Promise<Response<T>> {
|
||||
async delete<T>(url: string, options?: RequestOptions): Promise<Response<T>> {
|
||||
return this.request({
|
||||
method: 'DELETE',
|
||||
url,
|
||||
|
||||
Reference in New Issue
Block a user