fix(http): fix check logic to decide whether to set `Origin` header (#1438)

ref: https://github.com/tauri-apps/plugins-workspace/issues/1389#issuecomment-2150470335
pull/1044/head
Amr Bashir 1 year ago committed by GitHub
parent d9fa37ada5
commit da8a7bbe3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"http": "patch"
---
Fix `ORIGIN` header containing 2 URLs when `unsafe-headers` feature flag is enabled.

@ -224,8 +224,8 @@ pub async fn fetch<R: Runtime>(
request = request.header(header::USER_AGENT, "tauri-plugin-http");
}
if !(cfg!(feature = "unsafe-headers")
&& headers.contains_key(header::ORIGIN.as_str()))
if cfg!(feature = "unsafe-headers")
&& !headers.contains_key(header::ORIGIN.as_str())
{
if let Ok(url) = webview.url() {
request =

Loading…
Cancel
Save