Skip to content

Commit 1f649c7

Browse files
authored
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
1 parent 0ca4cc9 commit 1f649c7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

plugins/http/src/commands.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ pub async fn fetch<R: Runtime>(
191191
let name = HeaderName::from_str(&h)?;
192192
#[cfg(not(feature = "unsafe-headers"))]
193193
if is_unsafe_header(&name) {
194+
#[cfg(debug_assertions)]
195+
{
196+
eprintln!("[\x1b[33mWARNING\x1b[0m] Skipping {name} header as it is a forbidden header per fetch spec https://fetch.spec.whatwg.org/#terminology-headers");
197+
eprintln!("[\x1b[33mWARNING\x1b[0m] if keeping the header is a desired behavior, you can enable `unsafe-headers` feature flag in your Cargo.toml");
198+
}
194199
continue;
195200
}
196201

0 commit comments

Comments
 (0)