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

Commit

Permalink
Enh/route templating logic (#24)
Browse files Browse the repository at this point in the history
* Enhance route templating for matched Connection Model Definition

* Bump version to 4.1.3
  • Loading branch information
paulkr authored May 17, 2024
1 parent 8f80dd9 commit ce186b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 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.2"
version = "4.1.3"
edition = "2021"
repository = "https://github.com/integration-os/integrationos-domain"

Expand Down
10 changes: 9 additions & 1 deletion src/service/client/unified_destination_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn template_route(model_definition_path: String, full_request_path: String) -> S
let mut template = String::new();

for (i, segment) in model_definition_segments.iter().enumerate() {
if segment.starts_with(':') {
if segment.starts_with(':') || (segment.starts_with("{{") && segment.ends_with("}}")) {
template.push_str(full_request_segments[i]);
} else {
template.push_str(segment);
Expand Down Expand Up @@ -1175,5 +1175,13 @@ mod tests {
),
"customers/123/orders/456".to_string()
);

assert_eq!(
template_route(
"/customers/{{id}}/orders/{{order_id}}".to_string(),
"/customers/123/orders/456".to_string()
),
"customers/123/orders/456".to_string()
);
}
}

0 comments on commit ce186b8

Please sign in to comment.