diff --git a/h3i/src/frame.rs b/h3i/src/frame.rs index e3d99bf533..aab12f7b08 100644 --- a/h3i/src/frame.rs +++ b/h3i/src/frame.rs @@ -237,6 +237,14 @@ impl From> for EnrichedHeaders { } } +impl PartialEq for EnrichedHeaders { + fn eq(&self, other: &StatusCode) -> bool { + self.status_code() + .map(|status| status.ok() == Some(*other)) + .unwrap_or(false) + } +} + impl TryFrom for EnrichedHeaders { type Error = BoxError; @@ -446,7 +454,14 @@ mod tests { let enriched = H3iFrame::Headers(header_frame.into()) .to_enriched_headers() .unwrap(); - assert!(enriched.status_code().is_none()); } + + #[test] + fn test_status_code_interaction() { + let header_frame = + EnrichedHeaders::from(vec![Header::new(b":status", b"200")]); + + assert_eq!(header_frame, StatusCode::OK); + } }