apply authentication data to requests

This commit is contained in:
ranfdev
2023-11-15 10:00:45 +01:00
parent aae34e9da1
commit f13146ee7c
3 changed files with 57 additions and 13 deletions

View File

@ -157,6 +157,14 @@ impl Subscription {
.append_pair("since", &since.to_string());
Ok(url)
}
pub fn build_auth_url(server: &str, topic: &str) -> Result<url::Url, crate::Error> {
let mut url = url::Url::parse(server)?;
url.path_segments_mut()
.map_err(|_| url::ParseError::RelativeUrlWithCannotBeABaseBase)?
.push(topic)
.push("auth");
Ok(url)
}
pub fn validate(self) -> Result<Self, Vec<crate::Error>> {
let mut errs = vec![];
if let Err(e) = validate_topic(&self.topic) {