diff --git a/src/http/requests.rs b/src/http/requests.rs index b085f6c..5d482f2 100644 --- a/src/http/requests.rs +++ b/src/http/requests.rs @@ -26,7 +26,14 @@ impl URL { Some(key) => key.to_string(), None => continue, }; - let value = key_value.next().unwrap_or("").to_string(); + let value = key_value + .next() + .unwrap_or("") + .to_string() + .replace("+", " ") + .replace("%20", " ") + .replace("%23", "#") + .replace("%2C", ","); query.insert(key, value); } @@ -41,13 +48,13 @@ impl URL { } /// Utility function to get a path segment by index - /// + /// /// This is a very simple function, and its implementation is fairly naïve - /// + /// /// index: Index of the path segment to get - /// + /// /// # Examples - /// + /// /// ``` /// let url = URL::new("/path/to/resource").unwrap(); /// assert_eq!(url.get_path_segment(1), Some("to")); @@ -94,7 +101,11 @@ impl Request { None => return RequestStatus::MalformedHTTP(stream), }; - RequestStatus::Ok(Request { stream, method, url }) + RequestStatus::Ok(Request { + stream, + method, + url, + }) } pub fn mut_stream(self) -> TcpStream {