diff --git a/core/http/src/handling/request/cookies.rs b/core/http/src/handling/request/cookies.rs index c9d0fcd6f616087186ea5424754299d2ac8ccc57..c11bd45e292e99d609283119f30a3a6b700613d0 100644 --- a/core/http/src/handling/request/cookies.rs +++ b/core/http/src/handling/request/cookies.rs @@ -45,6 +45,7 @@ mod test { ]; let mut wrong = vec!["GET / HTTP/1.1".to_string()]; + assert_eq!(None, extract_cookies_from_vec(&mut wrong)); let cookies = extract_cookies_from_vec(&mut request_vec); assert_eq!(right_finished_vec, request_vec); diff --git a/core/http/src/setup.rs b/core/http/src/setup.rs old mode 100644 new mode 100755 index 4a3914b25034c96404c932051f772983cac1c4e9..c7f45228e9b40bdc501fa71c9eb1fb3fce8926e3 --- a/core/http/src/setup.rs +++ b/core/http/src/setup.rs @@ -65,6 +65,18 @@ impl<'a> Config { } self } + /// # Launches/Starts the webserver + /// Launches a Webserver Configuration + /// + /// Is Async + /// + /// Is Blocking -> Can be interrupted with ^C + /// + /// # Panics + /// Panics if there are no Mountpoints in the Confiuration to lauch, as well as when the there + /// is no interrupt signal + /// + /// Panics if . pub async fn launch(self) { println!("Server launched from http://{}", self.address.local_addr().unwrap()); let mut sigint = signal(SignalKind::interrupt()).unwrap(); @@ -82,6 +94,22 @@ impl<'a> Config { } } } +/// # Creates a Webserver Config which can be launched with the launch function +/// Takes the IP and Port as an argument +/// +/// Prints out the configuration test +/// +/// Is async +/// +/// # Example +/// ``` +/// async fn example() { +/// let _ = http::build("127.0.0.1:8000"); +/// } +/// ``` +/// # Panics +/// Panics if the IP is not bindable, or other forms of system errors or it's not a valid +/// IP-Address pub async fn build(ip: &str) -> Config { let listener = if let Ok(listener) = TcpListener::bind(ip).await { listener