Skip to content

Commit d4217c0

Browse files
committed
Debug for endpoints
1 parent 1160eff commit d4217c0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/src/endpoints.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ pub struct Endpoint {
2626
impl Endpoint {
2727
/// Converts Endpoint to resource. Does not save it.
2828
pub fn to_resource(&self, store: &impl Storelike) -> AtomicResult<Resource> {
29-
let subject = format!("{}{}", store.get_server_url(), self.path);
29+
let subject = store
30+
.get_server_url()
31+
.clone()
32+
.set_path(&self.path)
33+
.to_string();
3034
let mut resource = store.get_resource_new(&subject);
3135
resource.set_propval_string(urls::DESCRIPTION.into(), &self.description, store)?;
3236
resource.set_propval_string(urls::SHORTNAME.into(), &self.shortname, store)?;
@@ -42,6 +46,14 @@ impl Endpoint {
4246
}
4347
}
4448

49+
impl std::fmt::Debug for Endpoint {
50+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
51+
f.debug_struct("Endpoint")
52+
.field("path", &self.path)
53+
.finish()
54+
}
55+
}
56+
4557
pub fn default_endpoints() -> Vec<Endpoint> {
4658
vec![
4759
plugins::versioning::version_endpoint(),

0 commit comments

Comments
 (0)