diff --git a/protocol/gurtca/src/client.rs b/protocol/gurtca/src/client.rs index f710bd4..aae2351 100644 --- a/protocol/gurtca/src/client.rs +++ b/protocol/gurtca/src/client.rs @@ -189,4 +189,8 @@ impl GurtCAClient { anyhow::bail!("HTTP bootstrap failed: {}", response.status()) } } + + pub async fn post_json(&self, url: &str, data: &T) -> Result { + self.gurt_client.post_json(url, data).await.map_err(Into::into) + } } \ No newline at end of file diff --git a/protocol/library/src/client.rs b/protocol/library/src/client.rs index cb7c3ac..c8f68dd 100644 --- a/protocol/library/src/client.rs +++ b/protocol/library/src/client.rs @@ -631,12 +631,12 @@ mod tests { async fn test_url_parsing() { let client = GurtClient::new(); - let (host, port, path) = client.parse_url("gurt://example.com/test").unwrap(); + let (host, port, path) = client.parse_gurt_url("gurt://example.com/test").unwrap(); assert_eq!(host, "example.com"); assert_eq!(port, DEFAULT_PORT); assert_eq!(path, "/test"); - let (host, port, path) = client.parse_url("gurt://example.com:8080/api/v1").unwrap(); + let (host, port, path) = client.parse_gurt_url("gurt://example.com:8080/api/v1").unwrap(); assert_eq!(host, "example.com"); assert_eq!(port, 8080); assert_eq!(path, "/api/v1"); diff --git a/protocol/library/src/server.rs b/protocol/library/src/server.rs index 42f940a..055b73c 100644 --- a/protocol/library/src/server.rs +++ b/protocol/library/src/server.rs @@ -570,10 +570,16 @@ mod tests { assert!(!route.matches(&GurtMethod::POST, "/test")); assert!(!route.matches(&GurtMethod::GET, "/other")); + assert!(!route.matches(&GurtMethod::GET, "/test?foo=bar")); + assert!(!route.matches(&GurtMethod::GET, "/test?page=1&limit=100")); + let wildcard_route = Route::get("/api/*"); assert!(wildcard_route.matches(&GurtMethod::GET, "/api/users")); assert!(wildcard_route.matches(&GurtMethod::GET, "/api/posts")); assert!(!wildcard_route.matches(&GurtMethod::GET, "/other")); + + assert!(wildcard_route.matches(&GurtMethod::GET, "/api/users?id=123")); + assert!(wildcard_route.matches(&GurtMethod::GET, "/api/posts?page=2")); } } \ No newline at end of file