diff --git a/core/http/Cargo.toml b/core/http/Cargo.toml index 5d24dbd889e2de9c7013b930d543cecd6cbf3aed..4d7fb4f568a8d1945da3f344b198a2cc241791e5 100644 --- a/core/http/Cargo.toml +++ b/core/http/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" edition = "2021" [features] +defautl = [] secure = [] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/core/http/src/utils/url_utils/uri.rs b/core/http/src/utils/url_utils/uri.rs index 3a726a3422330e3526e67bce220e2a45a34ecb15..0a36f30cf6d72bc80a6a40e5ea2d80072146be94 100644 --- a/core/http/src/utils/url_utils/uri.rs +++ b/core/http/src/utils/url_utils/uri.rs @@ -2,7 +2,11 @@ use std::str::FromStr; use crate::{ setup::MountPoint, - utils::{url_utils::datatypes::RawUriElement, urlencoded::UrlEncodeData, vec_utils::remove_n}, + utils::{ + url_utils::datatypes::RawUriElement, + urlencoded::{EnCodable, UrlEncodeData}, + vec_utils::remove_n, + }, }; use super::datatypes::{ParseUriError, RawUri, Uri}; @@ -21,7 +25,12 @@ impl MountPoint { impl Uri { pub fn new(parts: Vec<&str>) -> Self { Self { - raw: "/".to_owned() + &parts.join("/"), + raw: "/".to_owned() + + &parts + .iter() + .map(|part| part.encode()) + .collect::<Vec<String>>() + .join("/"), parts: parts.into_iter().map(UrlEncodeData::from_raw).collect(), } } @@ -214,7 +223,7 @@ mod test { #[test] fn uri_to_string() { - assert_eq!("/a/%20", Uri::new(vec!["a", " "]).to_string()); + assert_eq!("a/%20", Uri::new(vec!["a", " "]).to_string()); } #[test]