Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion opentelemetry-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ http = { workspace = true }
http-body-util = { workspace = true, optional = true }
hyper = { workspace = true, optional = true }
hyper-util = { workspace = true, features = ["client-legacy", "http1", "http2"], optional = true }
opentelemetry = { workspace = true, features = ["trace"] }
opentelemetry = { path = "../opentelemetry", version = "0.30.0", features = ["trace"] }
reqwest = { workspace = true, optional = true }
tokio = { workspace = true, features = ["time"], optional = true }

Expand Down
38 changes: 0 additions & 38 deletions opentelemetry-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ impl Extractor for HeaderExtractor<'_> {
.map(|value| value.as_str())
.collect::<Vec<_>>()
}

/// Get all the values for a key from the HeaderMap
fn get_all(&self, key: &str) -> Option<Vec<&str>> {
let all_iter = self.0.get_all(key).iter();
if let (0, Some(0)) = all_iter.size_hint() {
return None;
}

Some(all_iter.filter_map(|value| value.to_str().ok()).collect())
}
}

pub type HttpError = Box<dyn std::error::Error + Send + Sync + 'static>;
Expand Down Expand Up @@ -251,8 +241,6 @@ impl<T> ResponseExt for Response<T> {

#[cfg(test)]
mod tests {
use http::HeaderValue;

use super::*;

#[test]
Expand All @@ -267,32 +255,6 @@ mod tests {
)
}

#[test]
fn http_headers_get_all() {
let mut carrier = http::HeaderMap::new();
carrier.append("headerName", HeaderValue::from_static("value"));
carrier.append("headerName", HeaderValue::from_static("value2"));
carrier.append("headerName", HeaderValue::from_static("value3"));

assert_eq!(
HeaderExtractor(&carrier).get_all("HEADERNAME"),
Some(vec!["value", "value2", "value3"]),
"all values from a key extraction"
)
}

#[test]
fn http_headers_get_all_missing_key() {
let mut carrier = http::HeaderMap::new();
carrier.append("headerName", HeaderValue::from_static("value"));

assert_eq!(
HeaderExtractor(&carrier).get_all("not_existing"),
None,
"all values from a missing key extraction"
)
}

#[test]
fn http_headers_keys() {
let mut carrier = http::HeaderMap::new();
Expand Down
Loading