Skip to content

Commit

Permalink
chore: print a warning in development for forbidden headers (#1981)
Browse files Browse the repository at this point in the history
* chore: print a warning in development for forbidden headers

closes #1979

* Update plugins/http/src/commands.rs
  • Loading branch information
amrbashir authored Oct 30, 2024
1 parent 0ca4cc9 commit 1f649c7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/http/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ pub async fn fetch<R: Runtime>(
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;
}

Expand Down

0 comments on commit 1f649c7

Please sign in to comment.