Skip to content

Commit

Permalink
Debug for endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Feb 24, 2023
1 parent b04e6b4 commit e6d0a08
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/src/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Resource> {
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)?;
Expand All @@ -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<Endpoint> {
vec![
plugins::versioning::version_endpoint(),
Expand Down

0 comments on commit e6d0a08

Please sign in to comment.