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 <amrbashir@users.noreply.github.com>
This commit is contained in:
Niko Korvenlaita
2024-10-16 12:57:52 +00:00
committed by tauri-bot
parent fd0290a458
commit 241e0fa1d2

View File

@@ -264,6 +264,14 @@ pub async fn fetch<R: Runtime>(
}
}
// 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);
}