diff --git a/api/src/rest/types.rs b/api/src/rest/types.rs index 1978d27..4c56c81 100644 --- a/api/src/rest/types.rs +++ b/api/src/rest/types.rs @@ -31,7 +31,7 @@ impl Url<'_> { } fn extract_path_segments(path: &str) -> Vec<&str> { - path.split('/').skip(1).collect() + path.split_terminator('/').skip(1).collect() } fn extract_query_params(query: Option<&str>) -> Vec { @@ -64,11 +64,11 @@ mod tests { } #[test] - fn should_extract_tralling_slash_as_empty_segment() { + fn should_not_extract_tralling_slash_as_empty_segment() { let path = "/hello/world/"; let segments = extract_path_segments(path); - assert_eq!(segments, ["hello", "world", ""]); + assert_eq!(segments, ["hello", "world"]); } #[test]