added endpoint client

This commit is contained in:
Andre Heber
2024-02-26 15:09:54 +01:00
parent 2f4895928f
commit c4817e486c
2 changed files with 17 additions and 28 deletions

View File

@ -8,6 +8,18 @@ pub struct TestApp {
pub connection_pool: Pool<Postgres>,
}
impl TestApp {
pub async fn post_subscriptions(&self, body: String) -> reqwest::Response {
reqwest::Client::new()
.post(&format!("{}/subscriptions", &self.address))
.header("Content-Type", "application/x-www-form-urlencoded")
.body(body)
.send()
.await
.expect("Failed to execute request.")
}
}
static TRACING: Lazy<()> = Lazy::new(|| {
let default_filter_level = "info".to_string();
let subscriber_name = "test".to_string();