diff --git a/mithril-aggregator/src/http_server/mod.rs b/mithril-aggregator/src/http_server/mod.rs index 920abfcf3d0..67a702330af 100644 --- a/mithril-aggregator/src/http_server/mod.rs +++ b/mithril-aggregator/src/http_server/mod.rs @@ -2,3 +2,5 @@ mod routes; mod server; pub use server::{Server, SERVER_BASE_PATH}; + +pub const MITHRIL_API_VERSION: &str = "0.1.0"; diff --git a/mithril-aggregator/src/http_server/routes/router.rs b/mithril-aggregator/src/http_server/routes/router.rs index d34e1fad7e8..bf4d614c7c9 100644 --- a/mithril-aggregator/src/http_server/routes/router.rs +++ b/mithril-aggregator/src/http_server/routes/router.rs @@ -1,8 +1,9 @@ use crate::http_server::routes::{ certificate_routes, epoch_routes, signatures_routes, signer_routes, snapshot_routes, }; -use crate::http_server::SERVER_BASE_PATH; +use crate::http_server::{MITHRIL_API_VERSION, SERVER_BASE_PATH}; use crate::DependencyManager; +use reqwest::header::{HeaderMap, HeaderValue}; use std::sync::Arc; use warp::http::Method; use warp::Filter; @@ -15,6 +16,11 @@ pub fn routes( .allow_any_origin() .allow_headers(vec!["content-type"]) .allow_methods(vec![Method::GET, Method::POST, Method::OPTIONS]); + let mut headers = HeaderMap::new(); + headers.insert( + "mithril-api-version", + HeaderValue::from_static(MITHRIL_API_VERSION), + ); warp::any().and(warp::path(SERVER_BASE_PATH)).and( certificate_routes::routes(dependency_manager.clone()) @@ -22,6 +28,7 @@ pub fn routes( .or(signer_routes::routes(dependency_manager.clone())) .or(signatures_routes::routes(dependency_manager.clone())) .or(epoch_routes::routes(dependency_manager)) - .with(cors), + .with(cors) + .with(warp::reply::with::headers(headers)), ) }