feat: regex filter searches full name

This commit is contained in:
əlemi 2024-10-21 16:18:33 +02:00
parent d504c650dd
commit 1798ce3f4e
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 7 additions and 2 deletions

View file

@ -34,3 +34,7 @@ pub fn stringify_json(v: &serde_json::Value) -> String {
} }
} }
// keep it as separate fn so we can change it everywhere easily
pub fn full_name(namespace: &str, name: &str) -> String {
format!("{namespace}:{name}")
}

View file

@ -151,7 +151,8 @@ async fn run_collection_endpoints(
let env = std::sync::Arc::new(collection.env.unwrap_or_default()); let env = std::sync::Arc::new(collection.env.unwrap_or_default());
for (name, mut endpoint) in collection.route.unwrap_or_default() { for (name, mut endpoint) in collection.route.unwrap_or_default() {
if pattern.find(&name).is_none() { continue }; let full_name = ext::full_name(&namespace, &name);
if pattern.find(&full_name).is_none() { continue };
if debug { endpoint.extract = Some(ext::StringOr::T(model::ExtractorConfig::Debug)) }; if debug { endpoint.extract = Some(ext::StringOr::T(model::ExtractorConfig::Debug)) };
let _client = client.clone(); let _client = client.clone();
@ -160,7 +161,7 @@ async fn run_collection_endpoints(
let task = async move { let task = async move {
let before = chrono::Local::now(); let before = chrono::Local::now();
eprintln!(" : [{}] {_namespace}:{name} \tsending request...", before.format(fmt::TIMESTAMP_FMT)); eprintln!(" : [{}] {full_name} \tsending request...", before.format(fmt::TIMESTAMP_FMT));
let res = if dry_run { let res = if dry_run {
Ok("".to_string()) Ok("".to_string())