Skip to content

[bug] http.fetch with timeout integer config cause error #4004

@rming

Description

@rming

Describe the bug

http.fetch with config {timeout: 12} cause Error

invalid type: integer `12`, expected struct Duration

test code : https://github.com/Rming/tauri-example

Reproduction

  1. clone test code and run cargo tauri dev
  2. error will output in the console

Expected behavior

https://tauri.studio/docs/api/js/interfaces/http.HttpOptions#timeout
may be a bug or doc needs to be updated

Platform and versions

Environment
  › OS: Mac OS 12.3.1 X64
  › Node.js: 17.6.0
  › npm: 8.5.1
  › pnpm: Not installed!
  › yarn: 1.22.17
  › rustup: 1.24.3
  › rustc: 1.59.0
  › cargo: 1.59.0
  › Rust toolchain: stable-aarch64-apple-darwin

Packages
WARNING: no lock files found, defaulting to npm
  › @tauri-apps/cli [NPM]: 1.0.0-rc.9
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("unexpected end of input while parsing major version number")', /Users/afa/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/tauri-cli-1.0.0-rc.9/src/info.rs:535:67
stack backtrace:
   0:        0x104a78314 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h58c637f9e30d1b8a
   1:        0x104832504 - core::fmt::write::hc16ca97d9f5e0acd
   2:        0x104a731dc - std::io::Write::write_fmt::hd53dc7153ccce04d
   3:        0x104a7d734 - std::panicking::default_hook::{{closure}}::ha41f2cf175ca93cf
   4:        0x104a7d374 - std::panicking::default_hook::h838498b157804a1a
   5:        0x104a7e398 - std::panicking::rust_panic_with_hook::h7722806c30430655
   6:        0x104a7e0bc - std::panicking::begin_panic_handler::{{closure}}::h265229fa7cad6de7
   7:        0x104a7e028 - std::sys_common::backtrace::__rust_end_short_backtrace::hfa83d61d0ed14557
   8:        0x104a7dff4 - _rust_begin_unwind
   9:        0x104ca6048 - core::panicking::panic_fmt::hd3f68d55261c2af0
  10:        0x104ca6220 - core::result::unwrap_failed::hc1b85f369312af72
  11:        0x104bab590 - tauri_cli::info::VersionBlock::display::h600532245a508e80
  12:        0x104ba5578 - tauri_cli::info::command::hba1cf1976b5f6b66
  13:        0x1047e8730 - tauri_cli::run::h77dad4afa2b4e229
  14:        0x1047f2bfc - cargo_tauri::main::hfb371fa95b68fdc0
  15:        0x1047f2030 - std::sys_common::backtrace::__rust_begin_short_backtrace::h675900a9f970608c
  16:        0x1047f239c - _main
  › @tauri-apps/api

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions