Skip to content
Merged
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
16 changes: 5 additions & 11 deletions tonic/src/codec/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,13 @@ impl CompressionEncoding {
}
b"identity" => Ok(None),
other => {
// NOTE: Workaround for lifetime limitation. Resolved at Rust 1.79.
// https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html#extending-automatic-temporary-lifetime-extension
let other_debug_string;
let other = match std::str::from_utf8(other) {
Ok(s) => s,
Err(_) => &format!("{other:?}"),
};

let mut status = Status::unimplemented(format!(
"Content is compressed with `{}` which isn't supported",
match std::str::from_utf8(other) {
Ok(s) => s,
Err(_) => {
other_debug_string = format!("{other:?}");
&other_debug_string
}
}
"Content is compressed with `{other}` which isn't supported"
));

let header_value = enabled_encodings
Expand Down
Loading