How to resolve the client future?


I am trying to send a request to a server with data using hyper client. The way I am doing it is

fn send_request(remote: Remote) -> Result<hyper::Response, futures::Canceled> {
    let (tx, rx) = futures::oneshot();
    remote.spawn(|handle| {
        let client = Client::new(&handle);
        let uri = "http://localhost:8000".parse().unwrap();
        client.get(uri).map_err(|_err| ()).and_then(|resp| {
            println!("Never prints out");
        }).or_else(|_err| {

But send_request never returns because client.get(url).and_then(...) is never resolved (found out through print debugging).

The examples on Hyper site call at the end to get the response. But I really can’t use Core here because it cannot be shared across multiple threads. Is there any other way I can get the client.get(uri).and_then(...) future to run to completion?


What about an error? and_then runs on a successful resolution, but you don’t seem to send anything on the rx channel in case of error.


Here’s working example. Hope it helps.


Does this actually work for you? It is stuck just like my program is on my laptop and prints nothing. I wonder why!


Here’s log from travis:
And source code:


Thanks a bunch! It must be a network issue on my side and that’s why the surprise. Thanks again.