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
8 changes: 8 additions & 0 deletions tonic/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@
| Some(h2::Reason::INTERNAL_ERROR)
| Some(h2::Reason::FLOW_CONTROL_ERROR)
| Some(h2::Reason::SETTINGS_TIMEOUT)
| Some(h2::Reason::FRAME_SIZE_ERROR)
| Some(h2::Reason::COMPRESSION_ERROR)
| Some(h2::Reason::CONNECT_ERROR) => Code::Internal,
Some(h2::Reason::REFUSED_STREAM) => Code::Unavailable,
Expand Down Expand Up @@ -778,7 +779,7 @@
trailers: Option<&HeaderMap>,
status_code: http::StatusCode,
) -> Result<(), Option<Status>> {
if let Some(trailers) = trailers {

Check warning on line 782 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 Expand Up @@ -1007,6 +1008,13 @@
assert_eq!(source.reason(), Some(h2::Reason::CANCEL));
}

#[test]
#[cfg(feature = "server")]
fn code_from_h2_frame_size_error() {
let err = h2::Error::from(h2::Reason::FRAME_SIZE_ERROR);
assert_eq!(Status::code_from_h2(&err), Code::Internal);
}

#[test]
#[cfg(feature = "server")]
fn to_h2_error() {
Expand Down
Loading