Skip to content

Commit

Permalink
feat: regex filter searches full name
Browse files Browse the repository at this point in the history
  • Loading branch information
alemidev committed Oct 21, 2024
1 parent d504c65 commit 1798ce3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ async fn run_collection_endpoints(
let env = std::sync::Arc::new(collection.env.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)) };
let _client = client.clone();
Expand All @@ -160,7 +161,7 @@ async fn run_collection_endpoints(

let task = async move {
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 {
Ok("".to_string())
Expand Down

0 comments on commit 1798ce3

Please # to comment.