use crate::{CustomHttpConfig, HttpStatusCodeRange};
use std::collections::BTreeMap;
#[derive(Debug, Clone, PartialEq)]
pub struct HttpValidatorHelper;
impl HttpValidatorHelper {
#[allow(dead_code)]
pub fn new_github_config() -> CustomHttpConfig {
let mut headers = BTreeMap::new();
headers.insert("Authorization".to_string(), "Bearer $MATCH".to_string());
headers.insert("User-Agent".to_string(), "TEST_DD_SDS".to_string());
headers.insert("X-GitHub-Api-Version".to_string(), "2022-11-28".to_string());
CustomHttpConfig::default()
.with_endpoint("https://api.github.com/octocat".to_string())
.with_request_headers(headers)
.with_invalid_http_status_code(vec![HttpStatusCodeRange {
start: 401,
end: 404,
}])
.with_valid_http_status_code(vec![HttpStatusCodeRange {
start: 200,
end: 300,
}])
}
#[allow(dead_code)]
pub fn new_datadog_config() -> CustomHttpConfig {
let mut headers = BTreeMap::new();
headers.insert("DD-API-KEY".to_string(), "$MATCH".to_string());
headers.insert("User-Agent".to_string(), "TEST_DD_SDS".to_string());
headers.insert("Accept".to_string(), "application/json".to_string());
CustomHttpConfig::default()
.with_endpoint("https://$HOST/api/v1/validate".to_string())
.with_hosts(vec![
"api.datadoghq.com".to_string(),
"api.datadoghq.eu".to_string(),
"api.us3.datadoghq.com".to_string(),
"api.us5.datadoghq.com".to_string(),
"api.ddog-gov.com".to_string(),
"api.ap1.datadoghq.com".to_string(),
])
.with_request_headers(headers)
.with_invalid_http_status_code(vec![HttpStatusCodeRange {
start: 403,
end: 404,
}])
.with_valid_http_status_code(vec![HttpStatusCodeRange {
start: 200,
end: 300,
}])
}
}