tauri-apps / tauri-apps/plugins-workspace
[bug] Response.clone() headers lost with tauri-http-fetch
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 602
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 9
Description
### Describe the bug
The `Response` created by the tauri-http-fetch plugin overrides `.headers` using `Object.defineProperty` instead of passing headers into the `Response` constructor. Because of this, `response.clone().headers` is empty even though the original response has headers.
### Reproduction
1. Use tauri-http-fetch to fetch a request with headers.
2. Pass the response into ky.
3. In a hook, clone the response: `const clone = response.clone()`.
4. Inspect `clone.headers`: it’s empty even though `response.headers` has entries.
### Expected behavior
Headers should be carried through cloning. After calling `response.clone()`, all headers from the original should be present on the cloned response.
### Full `tauri info` output
```text
[✔] Environment
- OS: Ubuntu 25.10.0 x86_64 (X64) (ubuntu on wayland)
✔ webkit2gtk-4.1: 2.50.4
✔ rsvg2: 2.60.0
✔ rustc: 1.91.1 (ed61e7d7e 2025-11-07)
✔ cargo: 1.91.1 (ea2d97820 2025-10-10)
✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
✔ Rust toolchain: 1.91.1-x86_64-unknown-linux-gnu (default)
- node: 24.12.0
- npm: 11.6.2
- bun: 1.3.6
[-] Packages
- tauri 🦀: 2.10.1
- tauri-build 🦀: 2.5.4
- wry 🦀: 0.54.1
- tao 🦀: 0.34.5
- @tauri-apps/api ⱼₛ: not installed!
- @tauri-apps/cli ⱼₛ: 2.9.6 (outdated, latest: 2.10.0)
[-] Plugins
- tauri-plugin-store 🦀: 2.4.1, (outdated, latest: 2.4.2)
- @tauri-apps/plugin-store ⱼₛ: not installed!
- tauri-plugin-autostart 🦀: 2.5.1
- @tauri-apps/plugin-autostart ⱼₛ: not installed!
- tauri-plugin-single-instance 🦀: 2.3.6, (outdated, latest: 2.3.7)
- @tauri-apps/plugin-single-instance ⱼₛ: not installed!
- tauri-plugin-shell 🦀: 2.3.3, (outdated, latest: 2.3.5)
- @tauri-apps/plugin-shell ⱼₛ: not installed!
- tauri-plugin-deep-link 🦀: 2.4.5, (outdated, latest: 2.4.6)
- @tauri-apps/plugin-deep-link ⱼₛ: not installed!
- tauri-plugin-fs 🦀: 2.4.5
- @tauri-apps/plugin-fs ⱼₛ: not installed!
- tauri-plugin-http 🦀: 2.5.7
- @tauri-apps/plugin-http ⱼₛ: not installed!
- tauri-plugin-log 🦀: 2.7.1, (outdated, latest: 2.8.0)
- @tauri-apps/plugin-log ⱼₛ: not installed!
- tauri-plugin-opener 🦀: 2.5.2, (outdated, latest: 2.5.3)
- @tauri-apps/plugin-opener ⱼₛ: not installed!
- tauri-plugin-os 🦀: 2.3.2
- @tauri-apps/plugin-os ⱼₛ: not installed!
- tauri-plugin-updater 🦀: 2.9.0, (outdated, latest: 2.10.0)
- @tauri-apps/plugin-updater ⱼₛ: not installed!
[-] App
- build-type: bundle
- CSP: style-src 'unsafe-inline' 'self'; worker-src 'self' blob: data:; script-src 'self' https://*.i.posthog.com https://*.posthog.com; img-src 'self' asset: http://asset.localhost blob: data:; frame-ancestors 'self' https://*.posthog.com; connect-src ipc: http://ipc.localhost ht
tps://*.posthog.com https://*.i.posthog.com http://tauri.localhost; font-src http://tauri.localhost; default-src 'self' customprotocol: asset: https://*.posthog.com https://*.i.posthog.com
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: Vue.js
- bundler: Rollup
```
### Stack trace
```text
```
### Additional context
### 🛠 Fix suggestion
Construct the response like this:
```js
const res = new Response(body, {
status,
statusText,
headers: responseHeaders
});
Object.defineProperty(res, 'url', { value: url, enumerable: true });
return res;
Contributor guide
Assessment
This issue has not been assessed yet.