1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-07-15 19:58:05 +00:00

Can search users

This commit is contained in:
2020-06-23 15:06:26 +02:00
parent abf9a7fa82
commit 6fd5d01550
6 changed files with 66 additions and 8 deletions

@ -340,6 +340,15 @@ impl HttpRequestHandler {
Ok(self.post_string(name)?.parse::<i64>()?)
}
/// Get an optional number in the request. If none found, return a default value
pub fn post_u64_opt(&mut self, name: &str, default: u64) -> ResultBoxError<u64> {
if self.has_post_parameter(name) {
Ok(self.post_string(name)?.parse::<u64>()?)
} else {
Ok(default)
}
}
pub fn post_u64(&mut self, name: &str) -> ResultBoxError<u64> {
Ok(self.post_string(name)?.parse::<u64>()?)
}