pub fn send_request(
    mut req: Request<Body>,
    backend: &Backend,
) -> impl Future<Output = Result<Response<Body>, Error>> {
    let connector = Connector::new(backend);

    let host = canonical_host_header(req.headers(), req.uri(), backend);
    let uri = canonical_uri(
        req.uri(),
        std::str::from_utf8(host.as_bytes()).expect("Host was in UTF-8"),
        backend,
    );

    filter_outgoing_headers(req.headers_mut());
    req.headers_mut().insert(hyper::header::HOST, host);
    *req.uri_mut() = uri;

    async move {
        Ok(Client::builder()
            .set_host(false)
            .build(connector)
            .request(req)
            .await
            .map_err(|e| {
                eprintln!("Error: {:?}", e);
                e
            })?
            .map(Body::from))
    }
}
/// Sends the given request to the given backend.
///
/// Note that the backend's URI is used to determine which host to route the request to; the URI
/// and any HOST header in `req` is _not_ used for routing. If the request does not contain a HOST
/// header, one will be added, using the authority from the request's URI.
Sends the given request to the given backend.
Note that the backend's URI is used to determine which host to route the request to; the URI
and any HOST header in `req` is _not_ used for routing. If the request does not contain a HOST
header, one will be added, using the authority from the request's URI.
Sends the given request to the given backend . Note that the backend ' s URI is used to determine which host to route the request to ; the URI and any HOST header in ` req ` is _not_ used for routing . If the request does not contain a HOST header one will be added using the authority from the request ' s URI .
pub fn send_request(
    mut req: Request<Body>,
    backend: &Backend,
) -> impl Future<Output = Result<Response<Body>, Error>> {
    let connector = Connector::new(backend);
    let host = canonical_host_header(req.headers(), req.uri(), backend);
    let uri = canonical_uri(
        req.uri(),
        std::str::from_utf8(host.as_bytes()).expect("Host was in UTF-8"),
        backend,
    );
    filter_outgoing_headers(req.headers_mut());
    req.headers_mut().insert(hyper::header::HOST, host);
    *req.uri_mut() = uri;
    async move {
        Ok(Client::builder()
            .set_host(false)
            .build(connector)
            .request(req)
            .await
            .map_err(|e| {
                eprintln!("Error: {:?}", e);
                e
            })?
            .map(Body::from))
    }
}
pub fn send_request ( mut req : Request < Body > , backend : & Backend , ) -> impl Future < Output = Result < Response < Body > , Error > > { let connector = Connector :: new ( backend ) ; let host = canonical_host_header ( req . headers ( ) , req . uri ( ) , backend ) ; let uri = canonical_uri ( req . uri ( ) , std :: str :: from_utf8 ( host . as_bytes ( ) ) . expect ( " " ) , backend , ) ; filter_outgoing_headers ( req . headers_mut ( ) ) ; req . headers_mut ( ) . insert ( hyper :: header :: HOST , host ) ; * req . uri_mut ( ) = uri ; async move { Ok ( Client :: builder ( ) . set_host ( false ) . build ( connector ) . request ( req ) . await . map_err ( | e | { eprintln ! ( " " e ) ; e } ) ? . map ( Body :: from ) ) } }
Sends the given request to the given backend.
Sends the given request to the given backend .
req
Request<Body>
backend
&Backend
req
Request<Body>
backend
&Backend