From 1f649c7f1f5e15d24c5088e74d97bb9f49b13987 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Wed, 30 Oct 2024 15:26:46 +0300 Subject: [PATCH] chore: print a warning in development for forbidden headers (#1981) * chore: print a warning in development for forbidden headers closes #1979 * Update plugins/http/src/commands.rs --- plugins/http/src/commands.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/http/src/commands.rs b/plugins/http/src/commands.rs index 39a68973..f4bc3aab 100644 --- a/plugins/http/src/commands.rs +++ b/plugins/http/src/commands.rs @@ -191,6 +191,11 @@ pub async fn fetch( let name = HeaderName::from_str(&h)?; #[cfg(not(feature = "unsafe-headers"))] if is_unsafe_header(&name) { + #[cfg(debug_assertions)] + { + eprintln!("[\x1b[33mWARNING\x1b[0m] Skipping {name} header as it is a forbidden header per fetch spec https://fetch.spec.whatwg.org/#terminology-headers"); + eprintln!("[\x1b[33mWARNING\x1b[0m] if keeping the header is a desired behavior, you can enable `unsafe-headers` feature flag in your Cargo.toml"); + } continue; }