aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-09-22 22:24:45 +0200
committerHarald Eilertsen <haraldei@anduin.net>2018-09-22 22:24:45 +0200
commit5b740a7a2a50f049619797c9e4fcd7815fea259e (patch)
tree0cc2b262ecc8ded1f740c2ba80f85d1f1b91fa20
parenta5121b3fc8fd9ae15c27aac2e93eaf081bf82290 (diff)
downloadrust-zotapi-5b740a7a2a50f049619797c9e4fcd7815fea259e.tar.gz
rust-zotapi-5b740a7a2a50f049619797c9e4fcd7815fea259e.tar.bz2
rust-zotapi-5b740a7a2a50f049619797c9e4fcd7815fea259e.zip
Upgrade dep reqwest to 0.9.1.
-rw-r--r--Cargo.toml2
-rw-r--r--src/client.rs17
2 files changed, 9 insertions, 10 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 8713632..4db95b8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,7 @@ version = "0.1.0"
authors = ["haraldei"]
[dependencies]
-reqwest = "0.8"
+reqwest = "0.9.1"
serde = "1.0"
serde_urlencoded = "0.5.1"
diff --git a/src/client.rs b/src/client.rs
index c724526..098c0ac 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -18,8 +18,7 @@ use error::Error;
use item::ItemBuilder;
use reqwest::{
self,
- header::{Accept, ContentType, qitem},
- mime,
+ header::{ACCEPT, CONTENT_TYPE},
StatusCode,
};
use serde::Serialize;
@@ -82,13 +81,13 @@ impl Client {
{
let url = self.url(path, args);
let mut res = self.inner.get(&url)
- .header(Accept(vec![qitem(mime::APPLICATION_JSON)]))
+ .header(ACCEPT, "application/json")
.basic_auth(self.user.clone(), Some(self.pw.clone()))
.send()?;
match res.status() {
- StatusCode::Unauthorized => Err(Error::Unauthorized),
- StatusCode::Ok => {
+ StatusCode::UNAUTHORIZED => Err(Error::Unauthorized),
+ StatusCode::OK => {
let mut body = String::new();
res.read_to_string(&mut body)?;
Ok(body)
@@ -105,15 +104,15 @@ impl Client {
{
let url = self.url(path, &());
let mut res = self.inner.post(&url)
- .header(Accept(vec![qitem(mime::APPLICATION_JSON)]))
- .header(ContentType::form_url_encoded())
+ .header(ACCEPT, "application/json")
+ .header(CONTENT_TYPE, "application/x-www-form-urlencoded")
.basic_auth(self.user.clone(), Some(self.pw.clone()))
.form(&data)
.send()?;
match res.status() {
- StatusCode::Unauthorized => Err(Error::Unauthorized),
- StatusCode::Ok => {
+ StatusCode::UNAUTHORIZED => Err(Error::Unauthorized),
+ StatusCode::OK => {
let mut body = String::new();
res.read_to_string(&mut body)?;
Ok(body)