diff --git a/src/common/headers.rs b/src/common/headers.rs index 959bfc0..d521159 100644 --- a/src/common/headers.rs +++ b/src/common/headers.rs @@ -179,15 +179,6 @@ impl Headers { self.expect } - #[cfg(test)] - pub fn new(content_length: i32, expect: bool, chunked: bool) -> Self { - Self { - content_length, - expect, - chunked, - } - } - /// Parses a byte slice into a Headers structure for a HTTP request. /// /// The byte slice is expected to have the following format:
@@ -299,6 +290,16 @@ impl MediaType { mod tests { use super::*; + impl Headers { + pub fn new(content_length: i32, expect: bool, chunked: bool) -> Self { + Self { + content_length, + expect, + chunked, + } + } + } + #[test] fn test_default() { let headers = Headers::default(); diff --git a/src/request.rs b/src/request.rs index b699962..bf11ec9 100644 --- a/src/request.rs +++ b/src/request.rs @@ -129,15 +129,6 @@ impl RequestLine { fn min_len() -> usize { Method::Get.raw().len() + 1 + Version::Http10.raw().len() + 2 } - - #[cfg(test)] - pub fn new(method: Method, uri: &str, http_version: Version) -> Self { - Self { - method, - uri: Uri::new(uri), - http_version, - } - } } /// Wrapper over an HTTP Request. @@ -274,6 +265,16 @@ mod tests { } } + impl RequestLine { + pub fn new(method: Method, uri: &str, http_version: Version) -> Self { + Self { + method, + uri: Uri::new(uri), + http_version, + } + } + } + #[test] fn test_uri() { for tc in &vec![