Skip to content

Commit da8a7bb

Browse files
authored
fix(http): fix check logic to decide whether to set Origin header (#1438)
ref: #1389 (comment)
1 parent d9fa37a commit da8a7bb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changes/http-origin-duplicated.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"http": "patch"
3+
---
4+
5+
Fix `ORIGIN` header containing 2 URLs when `unsafe-headers` feature flag is enabled.

plugins/http/src/commands.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ pub async fn fetch<R: Runtime>(
224224
request = request.header(header::USER_AGENT, "tauri-plugin-http");
225225
}
226226

227-
if !(cfg!(feature = "unsafe-headers")
228-
&& headers.contains_key(header::ORIGIN.as_str()))
227+
if cfg!(feature = "unsafe-headers")
228+
&& !headers.contains_key(header::ORIGIN.as_str())
229229
{
230230
if let Ok(url) = webview.url() {
231231
request =

0 commit comments

Comments
 (0)