refac: skip only first / to prevent bugs
This commit is contained in:
parent
e976651169
commit
ad2c142203
|
@ -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> {
|
||||
|
|
Loading…
Reference in New Issue