diff options
author | Ferris Tseng <ferristseng@fastmail.fm> | 2020-03-22 18:16:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-22 18:16:10 -0400 |
commit | 3f13c0516565c234898fa2a95ed3c5ea32d6c5e6 (patch) | |
tree | dc5d6a8856a577380286720706b3bef2278ce2d8 | |
parent | 7fd5b7e7ca7174b4926fadb31decbec5e38a5cf0 (diff) | |
parent | 02215697b4c2f1497a4282762781ac910c6d5b7f (diff) |
Merge pull request #47 from ferristseng/version-response-optional
Make version and system fields optional on Version response
-rw-r--r-- | ipfs-api/src/client.rs | 2 | ||||
-rw-r--r-- | ipfs-api/src/response/tests/v0_version_1.json | 5 | ||||
-rw-r--r-- | ipfs-api/src/response/version.rs | 9 |
3 files changed, 13 insertions, 3 deletions
diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs index e7f3d65..3a37cf0 100644 --- a/ipfs-api/src/client.rs +++ b/ipfs-api/src/client.rs @@ -26,7 +26,7 @@ use hyper::{body, client::Builder}; use hyper_multipart::client::multipart; #[cfg(feature = "hyper")] use hyper_tls::HttpsConnector; -use parity_multiaddr::{Protocol}; +use parity_multiaddr::Protocol; use serde::{Deserialize, Serialize}; use serde_json; use std::{ diff --git a/ipfs-api/src/response/tests/v0_version_1.json b/ipfs-api/src/response/tests/v0_version_1.json new file mode 100644 index 0000000..2d3b706 --- /dev/null +++ b/ipfs-api/src/response/tests/v0_version_1.json @@ -0,0 +1,5 @@ +{ + "Version": "0.4.11", + "Commit": "", + "Repo": "6" +} diff --git a/ipfs-api/src/response/version.rs b/ipfs-api/src/response/version.rs index 57c6857..ec6837b 100644 --- a/ipfs-api/src/response/version.rs +++ b/ipfs-api/src/response/version.rs @@ -14,11 +14,16 @@ pub struct VersionResponse { pub version: String, pub commit: String, pub repo: String, - pub system: String, - pub golang: String, + + // Not declared in the IPFS interface spec. + pub system: Option<String>, + + // Only for the Go implementation of IPFS. + pub golang: Option<String>, } #[cfg(test)] mod tests { deserialize_test!(v0_version_0, VersionResponse); + deserialize_test!(v0_version_1, VersionResponse); } |