-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: support json response for mediator base path
Signed-off-by: Ondrej Prazak <ondrej.prazak@absa.africa>
- Loading branch information
Ondrej Prazak
committed
Mar 26, 2024
1 parent
05c92f2
commit 1a12ffb
Showing
2 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
mod common; | ||
|
||
use anyhow::Result; | ||
use log::info; | ||
use mediator::http_routes::ReadmeInfo; | ||
use reqwest::header::ACCEPT; | ||
use url::Url; | ||
|
||
use crate::common::test_setup::setup_env_logging; | ||
|
||
static LOGGING_INIT: std::sync::Once = std::sync::Once::new(); | ||
|
||
const ENDPOINT_ROOT: &str = "http://localhost:8005"; | ||
|
||
#[test] | ||
fn base_path_returns_readme() -> Result<()> { | ||
LOGGING_INIT.call_once(setup_env_logging); | ||
|
||
let client = reqwest::blocking::Client::new(); | ||
let endpoint: Url = ENDPOINT_ROOT.parse().unwrap(); | ||
|
||
let res = client | ||
.get(endpoint) | ||
.header(ACCEPT, "application/json") | ||
.send()? | ||
.error_for_status()?; | ||
info!("{:?}", res); | ||
|
||
let _: ReadmeInfo = res.json()?; | ||
|
||
Ok(()) | ||
} |