소스 검색

fix(core): http timeout field is optional, closes #4036

Lucas Nogueira 3 년 전
부모
커밋
ec79e075a9
2개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 2
      core/tauri/src/api/http.rs
  2. 2 2
      tooling/api/src/http.ts

+ 2 - 2
core/tauri/src/api/http.rs

@@ -48,7 +48,7 @@ pub struct ClientBuilder {
   /// Max number of redirections to follow.
   pub max_redirections: Option<usize>,
   /// Connect timeout for the request.
-  #[serde(deserialize_with = "deserialize_duration")]
+  #[serde(deserialize_with = "deserialize_duration", default)]
   pub connect_timeout: Option<Duration>,
 }
 
@@ -469,7 +469,7 @@ pub struct HttpRequestBuilder {
   /// The request body
   pub body: Option<Body>,
   /// Timeout for the whole request
-  #[serde(deserialize_with = "deserialize_duration")]
+  #[serde(deserialize_with = "deserialize_duration", default)]
   pub timeout: Option<Duration>,
   /// The response type (defaults to Json)
   pub response_type: Option<ResponseType>,

+ 2 - 2
tooling/api/src/http.ts

@@ -51,8 +51,8 @@ interface Duration {
 }
 
 interface ClientOptions {
-  maxRedirections: number
-  connectTimeout: number | Duration
+  maxRedirections?: number
+  connectTimeout?: number | Duration
 }
 
 enum ResponseType {