From 2dc783bf66c85a4b90bd72709a3791c89a3c553c Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Thu, 20 May 2021 20:20:29 +0200 Subject: [PATCH] Fix http::tests --- src/error.rs | 7 +++++++ src/http/parser.rs | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) 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() + ), } }