Add version method to HTTP RPC endpoint
This commit is contained in:
parent
2b92d24476
commit
9546b07d71
1 changed files with 6 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
use crate::cli::CF;
|
use crate::cli::CF;
|
||||||
use crate::cnf::MAX_CONCURRENT_CALLS;
|
use crate::cnf::MAX_CONCURRENT_CALLS;
|
||||||
|
use crate::cnf::PKG_NAME;
|
||||||
|
use crate::cnf::PKG_VERS;
|
||||||
use crate::dbs::DB;
|
use crate::dbs::DB;
|
||||||
use crate::err::Error;
|
use crate::err::Error;
|
||||||
use crate::net::session;
|
use crate::net::session;
|
||||||
|
@ -209,6 +211,10 @@ impl Rpc {
|
||||||
v if v.is_strand() => rpc.read().await.delete(v).await,
|
v if v.is_strand() => rpc.read().await.delete(v).await,
|
||||||
_ => return Response::failure(id, Failure::INVALID_PARAMS).send(chn).await,
|
_ => return Response::failure(id, Failure::INVALID_PARAMS).send(chn).await,
|
||||||
},
|
},
|
||||||
|
"version" => match params.len() {
|
||||||
|
0 => Ok(format!("{}-{}", PKG_NAME, *PKG_VERS).into()),
|
||||||
|
_ => return Response::failure(id, Failure::INVALID_PARAMS).send(chn).await,
|
||||||
|
},
|
||||||
_ => return Response::failure(id, Failure::METHOD_NOT_FOUND).send(chn).await,
|
_ => return Response::failure(id, Failure::METHOD_NOT_FOUND).send(chn).await,
|
||||||
};
|
};
|
||||||
// Return the final response
|
// Return the final response
|
||||||
|
|
Loading…
Reference in a new issue