tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
85.36k stars 2.58k forks source link

[bug] Use “plugin-http” can't set Headers #11723

Closed shiyanaaa closed 3 days ago

shiyanaaa commented 3 days ago

Describe the bug

import { fetch } from '@tauri-apps/plugin-http'; const defaultConfig={ method:"GET", headers:{ "Referer":"https://my.web.com/", "Origin":"https://my.web.com/" }, data:{}, ...config } return fetch(url,defaultConfig)

I have a web application that I want to port to windows and Android without changing any backend interfaces, but there is Referer authentication in the interface, so I use @tauri-apps/plugin-http, but I can't change the request headers

Reproduction

No response

Expected behavior

No response

Full tauri info output

none

Stack trace

No response

Additional context

No response

shiyanaaa commented 3 days ago

and I set tauri-plugin-http = { version = "2", features = ["unsafe-headers"] }