Skip to content

Commit a992609

Browse files
committed
Debug for endpoints
1 parent 99a2fec commit a992609

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/src/endpoints.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ pub struct PostEndpoint {
5656
impl Endpoint {
5757
/// Converts Endpoint to resource. Does not save it.
5858
pub fn to_resource(&self, store: &impl Storelike) -> AtomicResult<Resource> {
59-
let subject = format!("{}{}", store.get_server_url(), self.path);
59+
let subject = store
60+
.get_server_url()
61+
.clone()
62+
.set_path(&self.path)
63+
.to_string();
6064
let mut resource = store.get_resource_new(&subject);
6165
resource.set_propval_string(urls::DESCRIPTION.into(), &self.description, store)?;
6266
resource.set_propval_string(urls::SHORTNAME.into(), &self.shortname, store)?;
@@ -72,6 +76,14 @@ impl Endpoint {
7276
}
7377
}
7478

79+
impl std::fmt::Debug for Endpoint {
80+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
81+
f.debug_struct("Endpoint")
82+
.field("path", &self.path)
83+
.finish()
84+
}
85+
}
86+
7587
pub fn default_endpoints() -> Vec<Endpoint> {
7688
vec![
7789
plugins::versioning::version_endpoint(),

0 commit comments

Comments
 (0)