fix(lib): use hyper Bearer header style

Considering we kind-of hardcoded this authentication type anyway,
we now use the Auth-types provided by hyper 0.8.

The incentive here was the compiler telling us that there the
yup-oauth::Scheme type doesn't implement the hyper::authorization::Scheme
anymore, even though that clearly was the case. Also it couldn't be
reproduced in yup-oauth itself.

This will need some work to get correct again, so this is just a crude
patch to make it work again.
This commit is contained in:
Sebastian Thiel
2016-04-10 13:01:18 +02:00
parent 9e8a047ebf
commit 065cfdd22f
2 changed files with 4 additions and 5 deletions

View File

@@ -484,7 +484,7 @@ match result {
use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET};
% endif
use std::io::{Read, Seek};
use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location};
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
let mut dd = DefaultDelegate;
let mut dlg: &mut Delegate = match ${delegate} {
Some(d) => d,
@@ -690,8 +690,7 @@ else {
}
}
};
let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer,
access_token: token.access_token });
let auth_header = Authorization(Bearer { token: token.access_token });
% endif
% if request_value:
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();

View File

@@ -10,7 +10,7 @@ use mime::{Mime, TopLevel, SubLevel, Attr, Value};
use oauth2::{TokenType, Retry, self};
use hyper;
use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header,
HeaderFormat};
HeaderFormat, Bearer};
use hyper::http::h1::LINE_ENDING;
use hyper::method::Method;
use hyper::status::StatusCode;
@@ -632,7 +632,7 @@ pub struct ResumableUploadHelper<'a, A: 'a> {
pub start_at: Option<u64>,
pub auth: &'a mut A,
pub user_agent: &'a str,
pub auth_header: Authorization<oauth2::Scheme>,
pub auth_header: Authorization<Bearer>,
pub url: &'a str,
pub reader: &'a mut ReadSeek,
pub media_type: Mime,