pub struct SendRequest<B> { /* fields omitted */ }
The sender side of an established connection.
Polls to determine whether this sender can be used yet for a request.
If the associated connection is closed, this returns an Error.
Sends a Request
on the associated connection.
Returns a future that if successful, yields the Response
.
There are some key differences in what automatic things the Client
does for you that will not be done here:
Client
requires absolute-form Uri
s, since the scheme and
authority are need to connect. They aren't required here.
- Since the
Client
requires absolute-form Uri
s, it can add
the Host
header based on it. You must add a Host
header yourself
before calling this method.
- Since absolute-form
Uri
s are not required, if received, they will
be serialized as-is, irregardless of calling Request::set_proxy
.
use futures::Future;
use hyper::{Method, Request};
use hyper::header::Host;
let path = "/foo/bar".parse().expect("valid path");
let mut req = Request::new(Method::Get, path);
req.headers_mut().set(Host::new("hyper.rs", None));
let fut = tx.send_request(req)
.map(|res| {
assert!(res.status().is_success());
});
Formats the value using the given formatter. Read more