refac: skip only first / to prevent bugs

This commit is contained in:
Dmitriy Pleshevskiy 2022-05-13 10:56:24 +03:00
parent e976651169
commit ad2c142203
1 changed files with 2 additions and 2 deletions

View File

@ -12,14 +12,14 @@ impl Url<'_> {
pub fn parse(url: &str) -> Url {
let mut parts = url.splitn(2, '?');
let path = parts.next().unwrap_or_default().trim_matches('/');
let path = parts.next().unwrap_or_default();
let query = parts.next();
Url { path, query }
}
pub fn path_segments(&self) -> Vec<&str> {
self.path.split('/').collect()
self.path.split('/').skip(1).collect()
}
pub fn query_params(&self) -> Vec<QueryParam> {