Skip to content

Commit

Permalink
Check in bytes constructor
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Levick <[email protected]>
  • Loading branch information
rylev committed Oct 25, 2023
1 parent 2d77028 commit ecdce33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sdk/rust/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ impl HeaderValue {
/// Construct a `HeaderValue` from a bag of bytes
pub fn bytes(bytes: Vec<u8>) -> HeaderValue {
HeaderValue {
inner: HeaderValueRep::Bytes(bytes),
inner: String::from_utf8(bytes)
.map(HeaderValueRep::String)
.map_err(|e| HeaderValueRep::Bytes(e.into_bytes())),
}
}

Expand Down

0 comments on commit ecdce33

Please sign in to comment.