diff --git a/src/start_line.rs b/src/start_line.rs index 6c76620..1d511d8 100644 --- a/src/start_line.rs +++ b/src/start_line.rs @@ -47,8 +47,15 @@ impl<'a> HTTPStartLine<'a> { } } +impl<'a> Into for HTTPStartLine<'a> { + fn into(self) -> String { + let version: String = self.version.into(); + return format!("{} {} {}", self.method, self.target, version); + } +} + #[test] -fn test_start_line() { +fn test_parse() { struct Expect<'a> { method: &'a str, target: &'a str, @@ -89,3 +96,9 @@ fn test_start_line() { } } } + +#[test] +fn test_into_string() { + let sl: String = HTTPStartLine::new("POST", "/health", HTTPVersion::Http2).into(); + assert_eq!("POST /health HTTP/2".to_string(), sl); +}