Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/header/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/header/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down