diff --git a/src/header/name.rs b/src/header/name.rs index 1b4a39d6..ce04bc89 100644 --- a/src/header/name.rs +++ b/src/header/name.rs @@ -1270,7 +1270,10 @@ impl HeaderName { } } - pub(super) fn into_bytes(self) -> Bytes { + /// Returns a `Bytes` representation of the header. + /// + /// The returned string will always be lower case. + pub fn into_bytes(self) -> Bytes { self.inner.into() } } diff --git a/src/header/value.rs b/src/header/value.rs index 48308cb4..17ec555c 100644 --- a/src/header/value.rs +++ b/src/header/value.rs @@ -296,6 +296,19 @@ impl HeaderValue { self.as_ref() } + /// Converts a `HeaderValue` to a `Byte` slice. + /// + /// # Examples + /// + /// ``` + /// # use http::header::HeaderValue; + /// let val = HeaderValue::from_static("hello"); + /// assert_eq!(&val.into_bytes(), b"hello"); + /// ``` + pub fn into_bytes(self) -> Bytes { + self.inner.into() + } + /// Mark that the header value represents sensitive information. /// /// # Examples