diff --git a/src/util/bear.rs b/src/util/bear.rs index 5383d84..c524520 100644 --- a/src/util/bear.rs +++ b/src/util/bear.rs @@ -4,6 +4,7 @@ use std::iter::Peekable; use std::str::Chars; use crate::core::*; +use crate::util::validate::{ResultBuilder, Validate}; const MAX_PARAM_LEN: usize = 16384; @@ -133,6 +134,14 @@ impl<'de> de::Visitor<'de> for BearcapVisitor { } } +impl Validate for Bearcap { + fn validate(&self, builder: ResultBuilder) -> ResultBuilder { + builder.field(&self.url, "url", |f| { + f.check("URL must start with https://", |v| v.starts_with("https://")) + }) + } +} + #[cfg(test)] mod tests { use crate::util::bear::Bearcap;