atomic-bomb-engine 0.41.1

A high performance torture testing engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::models::api_endpoint::ApiEndpoint;
use anyhow::anyhow;
use std::collections::HashSet;

pub(crate) fn check_endpoints_names(endpoints: Vec<ApiEndpoint>) -> anyhow::Result<()> {
    let mut names_set = HashSet::new();
    for endpoint in endpoints {
        if endpoint.name.clone().is_empty() {
            return Err(anyhow!("api名称不能为空"));
        }
        if !names_set.insert(endpoint.name.clone()) {
            return Err(anyhow!("重复的name: {}", endpoint.name));
        }
    }
    Ok(())
}