We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d77028 commit b337273Copy full SHA for b337273
sdk/rust/src/http.rs
@@ -289,7 +289,9 @@ impl HeaderValue {
289
/// Construct a `HeaderValue` from a bag of bytes
290
pub fn bytes(bytes: Vec<u8>) -> HeaderValue {
291
HeaderValue {
292
- inner: HeaderValueRep::Bytes(bytes),
+ inner: String::from_utf8(bytes)
293
+ .map(HeaderValueRep::String)
294
+ .unwrap_or_else(|e| HeaderValueRep::Bytes(e.into_bytes())),
295
}
296
297
0 commit comments