Add localUrl to serialization

This commit is contained in:
Jaco Greeff 2017-11-21 15:02:54 +01:00
parent e67b05e632
commit 17df58b767
2 changed files with 6 additions and 1 deletions

View File

@ -297,6 +297,7 @@ mod server {
version: app.version, version: app.version,
author: app.author, author: app.author,
icon_url: app.icon_url, icon_url: app.icon_url,
local_url: app.local_url,
}) })
.collect() .collect()
} }

View File

@ -31,6 +31,9 @@ pub struct LocalDapp {
/// Dapp icon /// Dapp icon
#[serde(rename="iconUrl")] #[serde(rename="iconUrl")]
pub icon_url: String, pub icon_url: String,
/// Local development Url
#[serde(rename="localUrl")]
pub local_url: Option<String>,
} }
#[cfg(test)] #[cfg(test)]
@ -40,7 +43,7 @@ mod tests {
#[test] #[test]
fn dapp_serialization() { fn dapp_serialization() {
let s = r#"{"id":"skeleton","name":"Skeleton","description":"A skeleton dapp","version":"0.1","author":"Parity Technologies Ltd","iconUrl":"title.png"}"#; let s = r#"{"id":"skeleton","name":"Skeleton","description":"A skeleton dapp","version":"0.1","author":"Parity Technologies Ltd","iconUrl":"title.png","localUrl":"http://localhost:5000"}"#;
let dapp = LocalDapp { let dapp = LocalDapp {
id: "skeleton".into(), id: "skeleton".into(),
@ -49,6 +52,7 @@ mod tests {
version: "0.1".into(), version: "0.1".into(),
author: "Parity Technologies Ltd".into(), author: "Parity Technologies Ltd".into(),
icon_url: "title.png".into(), icon_url: "title.png".into(),
local_url: "http://localhost:5000".into(),
}; };
let serialized = serde_json::to_string(&dapp).unwrap(); let serialized = serde_json::to_string(&dapp).unwrap();