Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
Update passthrough route matcher to handle templated paths (#23)
Browse files Browse the repository at this point in the history
* Update passthrough route matcher to handle templated paths

* Bump version to 4.1.2
  • Loading branch information
paulkr authored May 17, 2024
1 parent f1a6ae9 commit 8f80dd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "integrationos-domain"
description = "Shared library for IntegrationOS"
license = "GPL-3.0"
version = "4.1.1"
version = "4.1.2"
edition = "2021"
repository = "https://github.com/integration-os/integrationos-domain"

Expand Down
10 changes: 7 additions & 3 deletions src/service/client/unified_destination_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ fn match_route<'a>(full_path: &'a str, routes: impl Iterator<Item = &'a str>) ->
if route_segments
.iter()
.zip(&segments)
.all(|(route_seg, path_seg)| route_seg == path_seg || route_seg.starts_with(':'))
.all(|(route_seg, path_seg)| {
route_seg == path_seg
|| route_seg.starts_with(':')
|| (route_seg.starts_with("{{") && route_seg.ends_with("}}"))
})
{
return Some(route);
}
Expand Down Expand Up @@ -1137,7 +1141,7 @@ mod tests {
let routes = [
"/customers",
"/customers/:id",
"/customers/:id/orders",
"/customers/{{id}}/orders",
"/customers/:id/orders/:order_id",
]
.into_iter();
Expand All @@ -1152,7 +1156,7 @@ mod tests {
);
assert_eq!(
match_route("/customers/123/orders", routes.clone()),
Some("/customers/:id/orders")
Some("/customers/{{id}}/orders")
);
assert_eq!(
match_route("/customers/123/orders/456", routes.clone()),
Expand Down

0 comments on commit 8f80dd9

Please sign in to comment.