From 241e0fa1d222e4e4b4f39d151098bd47e25a4412 Mon Sep 17 00:00:00 2001 From: Niko Korvenlaita Date: Wed, 16 Oct 2024 12:57:52 +0000 Subject: [PATCH] feat: allow http calls without origin header (#1941) Committed via a GitHub action: https://github.com/tauri-apps/plugins-workspace/actions/runs/11366118662 Co-authored-by: amrbashir --- src/commands.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/commands.rs b/src/commands.rs index cda21bd..39a6897 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -264,6 +264,14 @@ pub async fn fetch( } } + // In case empty origin is passed, remove it. Some services do not like Origin header + // so this way we can remove it in explicit way. The default behaviour is still to set it + if cfg!(feature = "unsafe-headers") + && headers.get(header::ORIGIN) == Some(&HeaderValue::from_static("")) + { + headers.remove(header::ORIGIN); + }; + if let Some(data) = data { request = request.body(data); }