aboutsummaryrefslogtreecommitdiffstats
path: root/src
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 /src
parenta5121b3fc8fd9ae15c27aac2e93eaf081bf82290 (diff)
downloadrust-zotapi-5b740a7a2a50f049619797c9e4fcd7815fea259e.tar.gz
rust-zotapi-5b740a7a2a50f049619797c9e4fcd7815fea259e.tar.bz2
rust-zotapi-5b740a7a2a50f049619797c9e4fcd7815fea259e.zip
Upgrade dep reqwest to 0.9.1.
Diffstat (limited to 'src')
-rw-r--r--src/client.rs17
1 files changed, 8 insertions, 9 deletions
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)