diff options
Diffstat (limited to 'ipfs-api-backend-actix/src/backend.rs')
-rw-r--r-- | ipfs-api-backend-actix/src/backend.rs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/ipfs-api-backend-actix/src/backend.rs b/ipfs-api-backend-actix/src/backend.rs index 6aa8f50..f61d70d 100644 --- a/ipfs-api-backend-actix/src/backend.rs +++ b/ipfs-api-backend-actix/src/backend.rs @@ -54,19 +54,16 @@ impl Backend for ActixBackend { where Req: ApiRequest, { - req.absolute_url(&self.base).and_then(|url| { - let req = if let Some(form) = form { - self.client - .post(url) - .timeout(ACTIX_REQUEST_TIMEOUT) - .content_type(form.content_type()) - .send_body(multipart::client::multipart::Body::from(form)) - } else { - self.client.post(url).timeout(ACTIX_REQUEST_TIMEOUT).send() - }; - - Ok(req) - }) + let url = req.absolute_url(&self.base)?; + let req = self.client.request(Req::METHOD, url); + let req = if let Some(form) = form { + req.content_type(form.content_type()) + .send_body(multipart::Body::from(form)) + } else { + req.timeout(ACTIX_REQUEST_TIMEOUT).send() + }; + + Ok(req) } fn get_header<'a>(res: &'a Self::HttpResponse, key: HeaderName) -> Option<&'a HeaderValue> { |