Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 065cfdd

Browse files
author
Sebastian Thiel
committed
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.
1 parent 9e8a047 commit 065cfdd

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/mako/api/lib/mbuild.mako

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ match result {
484484
use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET};
485485
% endif
486486
use std::io::{Read, Seek};
487-
use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location};
487+
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
488488
let mut dd = DefaultDelegate;
489489
let mut dlg: &mut Delegate = match ${delegate} {
490490
Some(d) => d,
@@ -690,8 +690,7 @@ else {
690690
}
691691
}
692692
};
693-
let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer,
694-
access_token: token.access_token });
693+
let auth_header = Authorization(Bearer { token: token.access_token });
695694
% endif
696695
% if request_value:
697696
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();

src/rust/api/cmn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use mime::{Mime, TopLevel, SubLevel, Attr, Value};
1010
use oauth2::{TokenType, Retry, self};
1111
use hyper;
1212
use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header,
13-
HeaderFormat};
13+
HeaderFormat, Bearer};
1414
use hyper::http::h1::LINE_ENDING;
1515
use hyper::method::Method;
1616
use hyper::status::StatusCode;
@@ -632,7 +632,7 @@ pub struct ResumableUploadHelper<'a, A: 'a> {
632632
pub start_at: Option<u64>,
633633
pub auth: &'a mut A,
634634
pub user_agent: &'a str,
635-
pub auth_header: Authorization<oauth2::Scheme>,
635+
pub auth_header: Authorization<Bearer>,
636636
pub url: &'a str,
637637
pub reader: &'a mut ReadSeek,
638638
pub media_type: Mime,

0 commit comments

Comments
 (0)