Skip to content

Commit

Permalink
fix(lib): use hyper Bearer header style
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Sebastian Thiel committed Apr 10, 2016
1 parent 9e8a047 commit 065cfdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/mako/api/lib/mbuild.mako
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/rust/api/cmn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 065cfdd

Please sign in to comment.