Start work on attestation endpoint

This commit is contained in:
Paul Hauner
2019-11-21 09:17:06 +11:00
parent b60836be7c
commit 451f8e6767
5 changed files with 87 additions and 37 deletions

View File

@@ -38,6 +38,15 @@ pub fn parse_epoch(string: &str) -> Result<Epoch, ApiError> {
.map_err(|e| ApiError::BadRequest(format!("Unable to parse epoch: {:?}", e)))
}
/// Parse an shard.
///
/// E.g., `"18"`
pub fn parse_shard(string: &str) -> Result<u64, ApiError> {
string
.parse::<u64>()
.map_err(|e| ApiError::BadRequest(format!("Unable to parse shard: {:?}", e)))
}
/// Checks the provided request to ensure that the `content-type` header.
///
/// The content-type header should either be omitted, in which case JSON is assumed, or it should