summaryrefslogtreecommitdiffstats
path: root/ipfs-api/src/client.rs
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2020-05-16 12:25:05 -0400
committerGitHub <noreply@github.com>2020-05-16 12:25:05 -0400
commitb263290045ed63830d839393f2d148edf331fa42 (patch)
treed667c3e017b97752c706bc10178b306e2ee354d4 /ipfs-api/src/client.rs
parent395cefb4cad7b2c4f59a7611907630c3a922666d (diff)
parentd617bb5480830e5e4d67292aa9d77008f8dc7279 (diff)
Merge pull request #50 from cag/use-post-only
Only use POST for IPFS v0.5 compat
Diffstat (limited to 'ipfs-api/src/client.rs')
-rw-r--r--ipfs-api/src/client.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs
index 3a37cf0..67c5d3d 100644
--- a/ipfs-api/src/client.rs
+++ b/ipfs-api/src/client.rs
@@ -144,8 +144,9 @@ impl IpfsClient {
#[cfg(feature = "hyper")]
{
url.parse::<Uri>().map_err(From::from).and_then(move |url| {
- let builder = http::Request::builder();
- let builder = builder.method(Req::METHOD.clone()).uri(url);
+ let builder = http::Request::builder()
+ .method("POST")
+ .uri(url);
let req = if let Some(form) = form {
form.set_body_convert::<hyper::Body, multipart::Body>(builder)
@@ -160,10 +161,10 @@ impl IpfsClient {
{
let req = if let Some(form) = form {
self.client
- .request(Req::METHOD.clone(), url)
+ .post(url)
.content_type(form.content_type())
} else {
- self.client.request(Req::METHOD.clone(), url)
+ self.client.post(url)
};
Ok(req.timeout(std::time::Duration::from_secs(90)))