Skip to content

Commit

Permalink
fix(api/http): correct types (#1360)
Browse files Browse the repository at this point in the history
* fix(api/http): correct types

* Add changes

* Update correct-http-api-types.md
  • Loading branch information
kidonng committed Mar 17, 2021
1 parent 4ee044a commit 2fc39fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .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).
16 changes: 8 additions & 8 deletions api/src/http.ts
@@ -1,7 +1,7 @@
import { invokeTauriCommand } from './helpers/tauri'

export interface ClientOptions {
maxRedirections: boolean
maxRedirections: number
connectTimeout: number
}

Expand Down Expand Up @@ -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,
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 2fc39fc

Please sign in to comment.