From 4660d2367606641578bbbbfbe0e0e77bd29a9b72 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 26 May 2017 10:14:39 +0200 Subject: [PATCH] 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 --- src/mako/Cargo.toml.mako | 3 +++ src/mako/api/lib/lib.mako | 4 ++-- src/mako/lib/util.mako | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mako/Cargo.toml.mako b/src/mako/Cargo.toml.mako index b76881b1fb..bb17e459d2 100644 --- a/src/mako/Cargo.toml.mako +++ b/src/mako/Cargo.toml.mako @@ -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 diff --git a/src/mako/api/lib/lib.mako b/src/mako/api/lib/lib.mako index bf85b43a9c..694e84a4e8 100644 --- a/src/mako/api/lib/lib.mako +++ b/src/mako/api/lib/lib.mako @@ -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())), ::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);\ ## You will still have to set the filter for your comment type - either nothing, or rust_doc_comment ! diff --git a/src/mako/lib/util.mako b/src/mako/lib/util.mako index de1b9e8268..e8e2d57d2b 100644 --- a/src/mako/lib/util.mako +++ b/src/mako/lib/util.mako @@ -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()};