mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
restore version route
This commit is contained in:
parent
0c17b166df
commit
6a742ee62c
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1786,7 +1786,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "meilisearch-http"
|
||||
version = "0.17.0"
|
||||
version = "0.21.0-alpha"
|
||||
dependencies = [
|
||||
"actix-cors",
|
||||
"actix-http 3.0.0-beta.4",
|
||||
|
@ -4,7 +4,7 @@ description = "MeiliSearch HTTP server"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
name = "meilisearch-http"
|
||||
version = "0.17.0"
|
||||
version = "0.21.0-alpha"
|
||||
[[bin]]
|
||||
name = "meilisearch"
|
||||
path = "src/main.rs"
|
||||
|
@ -56,5 +56,9 @@ struct VersionResponse {
|
||||
|
||||
#[get("/version", wrap = "Authentication::Private")]
|
||||
async fn get_version() -> HttpResponse {
|
||||
todo!()
|
||||
HttpResponse::Ok().json(VersionResponse {
|
||||
commit_sha: env!("VERGEN_SHA").to_string(),
|
||||
build_date: env!("VERGEN_BUILD_TIMESTAMP").to_string(),
|
||||
pkg_version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
})
|
||||
}
|
||||
|
@ -69,4 +69,8 @@ impl Server {
|
||||
pub async fn list_indexes(&self) -> (Value, StatusCode) {
|
||||
self.service.get("/indexes").await
|
||||
}
|
||||
|
||||
pub async fn version(&self) -> (Value, StatusCode) {
|
||||
self.service.get("/version").await
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ mod index;
|
||||
mod search;
|
||||
mod settings;
|
||||
mod updates;
|
||||
mod stats;
|
||||
|
||||
// Tests are isolated by features in different modules to allow better readability, test
|
||||
// targetability, and improved incremental compilation times.
|
||||
|
12
meilisearch-http/tests/stats/mod.rs
Normal file
12
meilisearch-http/tests/stats/mod.rs
Normal file
@ -0,0 +1,12 @@
|
||||
use crate::common::Server;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn get_settings_unexisting_index() {
|
||||
let server = Server::new().await;
|
||||
let (response, code) = server.version().await;
|
||||
assert_eq!(code, 200);
|
||||
let version = response.as_object().unwrap();
|
||||
assert!(version.get("commitSha").is_some());
|
||||
assert!(version.get("buildDate").is_some());
|
||||
assert!(version.get("pkgVersion").is_some());
|
||||
}
|
Loading…
Reference in New Issue
Block a user