Skip to content

Commit

Permalink
make into_sanitized_headers private
Browse files Browse the repository at this point in the history
  • Loading branch information
alce committed Nov 14, 2019
1 parent 69ad3be commit 19cee99
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions tonic/src/metadata/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,23 +249,7 @@ impl MetadataMap {
self.headers
}

/// Convert a MetadataMap into a HTTP HeaderMap
///
/// The returned map excludes headers reserved by the gRPC protocol.
///
/// # Examples
///
/// ```
/// # use tonic::metadata::*;
/// let mut map = MetadataMap::new();
/// map.insert("grpc-timeout", "1S".parse().unwrap());
/// map.insert("x-host", "example.com".parse().unwrap());
///
/// let http_map = map.into_sanitized_headers();
///
/// assert!(http_map.get("grpc-timeout").is_none());
/// ```
pub fn into_sanitized_headers(mut self) -> http::HeaderMap {
pub(crate) fn into_sanitized_headers(mut self) -> http::HeaderMap {
for r in &Self::GRPC_RESERVED_HEADERS {
self.headers.remove(*r);
}
Expand Down

0 comments on commit 19cee99

Please sign in to comment.