Selaa lähdekoodia

fix(core): HTTP timeout not working on Windows, closes #4050 (#4185)

Lucas Fernandes Nogueira 3 vuotta sitten
vanhempi
sitoutus
d99c5d583b
2 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 5 0
      .changes/fix-windows-timeout-http.md
  2. 5 0
      core/tauri/src/api/http.rs

+ 5 - 0
.changes/fix-windows-timeout-http.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Fixes HTTP timeout not working on Windows when using the `attohttpc` client.

+ 5 - 0
core/tauri/src/api/http.rs

@@ -143,6 +143,11 @@ impl Client {
 
     if let Some(timeout) = request.timeout {
       request_builder = request_builder.timeout(timeout);
+      #[cfg(windows)]
+      {
+        // on Windows the global timeout is not respected, see https://github.com/sbstp/attohttpc/issues/118
+        request_builder = request_builder.read_timeout(timeout);
+      }
     }
 
     let response = if let Some(body) = request.body {