diff --git a/src/error.rs b/src/error.rs index 6ba9b2e..c0360c5 100644 --- a/src/error.rs +++ b/src/error.rs @@ -90,6 +90,13 @@ impl fmt::Display for Error { } } +impl fmt::Debug for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.fmt(f); + Ok(()) + } +} + impl From for Error { fn from(error: std::io::Error) -> Self { Error { diff --git a/src/http/parser.rs b/src/http/parser.rs index c80aab2..c7a5818 100644 --- a/src/http/parser.rs +++ b/src/http/parser.rs @@ -324,7 +324,10 @@ mod tests { let mut parser = super::Parser::new_request_parser(request.as_bytes()); match parser.parse() { Ok(_v) => panic!("should fail"), - Err(e) => assert_eq!("invalid character at position 13", e), + Err(e) => assert_eq!( + "unable to parse http request: invalid character at position 13", + e.to_string() + ), } } @@ -334,7 +337,10 @@ mod tests { let mut parser = super::Parser::new_request_parser(request.as_bytes()); match parser.parse() { Ok(_v) => panic!("should fail"), - Err(e) => assert_eq!("input too short", e), + Err(e) => assert_eq!( + "unable to parse http request: input too short", + e.to_string() + ), } }