How do I send an HTTP request using a proxy with Hyper 0.11? I have the following working code that sends an HTTP request without proxy:
extern crate hyper;
extern crate tokio_core;
extern crate futures;
use futures::Future;
use hyper::Client;
use tokio_core::reactor::Core;
fn main() {
let mut core = Core::new().unwrap();
let client = Client::new(&core.handle());
let uri = "http://stackoverflow.com".parse().unwrap();
let work = client.get(uri).map(|res| {
res.status()
});
match core.run(work) {
Ok(status) => println!("Status: {}", status),
Err(e) => println!("Error: {:?}", e)
}
}
This is not a duplicate of How to reach an HTTPS site via proxy with Hyper? because I am asking about the new version of Hyper 0.11 that has a totally different API which is not compatible with previous versions.