use std::sync::Arc;
use wiremock::{Match, MockServer, Request};
pub const BETTER_STACK_ACCEPTED_STATUS: u16 = 202;
pub struct BodyCaptureMatcher {
pub captured: Arc<tokio::sync::Mutex<Vec<Vec<u8>>>>,
}
impl Match for BodyCaptureMatcher {
fn matches(&self, request: &Request) -> bool {
let body = request.body.clone();
let captured = self.captured.clone();
tokio::spawn(async move {
captured.lock().await.push(body);
});
true
}
}
pub fn mock_host(mock_server: &MockServer) -> String {
mock_server.uri().replace("http://", "")
}