Skip to content
Open
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
7 changes: 5 additions & 2 deletions tonic/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,11 @@
let details = match header_map.get(Self::GRPC_STATUS_DETAILS) {
Some(header) => crate::util::base64::STANDARD
.decode(header.as_bytes())
.expect("Invalid status header, expected base64 encoded value")
.into(),
.map(Bytes::from)
.unwrap_or_else(|_| {
warn!("error decoding grpc-status-details-bin header");
Bytes::new()
}),
None => Bytes::new(),
};

Expand Down Expand Up @@ -778,7 +781,7 @@
trailers: Option<&HeaderMap>,
status_code: http::StatusCode,
) -> Result<(), Option<Status>> {
if let Some(trailers) = trailers {

Check warning on line 784 in tonic/src/status.rs

View workflow job for this annotation

GitHub Actions / clippy

this `if` statement can be collapsed
if let Some(status) = Status::from_header_map(trailers) {
if status.code() == Code::Ok {
return Ok(());
Expand Down
Loading