Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api/http): correct types #1360

Merged
merged 3 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/correct-http-api-types.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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