fix(docs): Example now uses hyper_rustls

It's already done by the CLI, but the docs still showed
code that would only work in older hyper versions that still
shipped with HTTPS.

Fixes #169
This commit is contained in:
Sebastian Thiel
2017-05-26 10:14:39 +02:00
parent ad2748a691
commit 4660d23676
3 changed files with 6 additions and 2 deletions

View File

@@ -22,6 +22,9 @@ keywords = ["${name[:20]}", ${", ".join(estr(cargo.keywords))}]
name = "${util.program_name()}"
% endif
[dev-dependencies]
hyper-rustls = "^0.6"
[dependencies]
hyper = "^ 0.10"
## Must match the one hyper uses, otherwise there are duplicate similarly named `Mime` structs

View File

@@ -258,9 +258,9 @@ let secret: ApplicationSecret = Default::default();
// retrieve them from storage.
% endif
let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
hyper::Client::new(),
hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
<MemoryStorage as Default>::default(), None);
let mut hub = ${hub_type}::new(hyper::Client::new(), auth);\
let mut hub = ${hub_type}::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);\
</%def>
## You will still have to set the filter for your comment type - either nothing, or rust_doc_comment !

View File

@@ -43,6 +43,7 @@ ${util.crate_version(cargo.build_version, revision)}\
## Must be outside of a test function
<%def name="test_prelude()">\
extern crate hyper;
extern crate hyper_rustls;
extern crate yup_oauth2 as oauth2;
extern crate ${util.to_extern_crate_name(self.crate_name())} as ${self.library_name()};
</%def>