diff --git a/lib/src/endpoints.rs b/lib/src/endpoints.rs index 32468acff..c565618f4 100644 --- a/lib/src/endpoints.rs +++ b/lib/src/endpoints.rs @@ -26,7 +26,11 @@ pub struct Endpoint { impl Endpoint { /// Converts Endpoint to resource. Does not save it. pub fn to_resource(&self, store: &impl Storelike) -> AtomicResult { - let subject = format!("{}{}", store.get_server_url(), self.path); + let subject = store + .get_server_url() + .clone() + .set_path(&self.path) + .to_string(); let mut resource = store.get_resource_new(&subject); resource.set_propval_string(urls::DESCRIPTION.into(), &self.description, store)?; resource.set_propval_string(urls::SHORTNAME.into(), &self.shortname, store)?; @@ -42,6 +46,14 @@ impl Endpoint { } } +impl std::fmt::Debug for Endpoint { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Endpoint") + .field("path", &self.path) + .finish() + } +} + pub fn default_endpoints() -> Vec { vec![ plugins::versioning::version_endpoint(),