diff --git a/src/http.rs b/src/http.rs index 57029f4c..be4ab35a 100644 --- a/src/http.rs +++ b/src/http.rs @@ -742,9 +742,22 @@ mod tests { assert_eq!(read_status(&mut mem(s)), result); } + fn read_ignore_string(s: &str, result: HttpResult) { + match (read_status(&mut mem(s)), result) { + (Ok(RawStatus(ref c1, _)), Ok(RawStatus(ref c2, _))) => { + assert_eq!(c1, c2); + }, + (r1, r2) => assert_eq!(r1, r2) + } + } + read("200 OK\r\n", Ok(RawStatus(200, Borrowed("OK")))); read("404 Not Found\r\n", Ok(RawStatus(404, Borrowed("Not Found")))); read("200 crazy pants\r\n", Ok(RawStatus(200, Owned("crazy pants".to_string())))); + read("301 Moved Permanently\r\n", Ok(RawStatus(301, Owned("Moved Permanently".to_string())))); + read_ignore_string("301 Unreasonably long header that should not happen, \ + but some men just want to watch the world burn\r\n", + Ok(RawStatus(301, Owned("Ignored".to_string())))); } #[test]