fn clone_request(request: &Request<Body>, body: Option<&Vec<u8>>) -> Request<Body> {
    Request::builder()
        .method(request.method())
        .header(
            header::CONTENT_TYPE,
            request
                .headers()
                .get(header::CONTENT_TYPE)
                .expect("Cannot clone request without a content-type header."),
        )
        .uri(request.uri().clone())
        .body((|| {
            if body.is_some() {
                return Body::from(body.unwrap().clone());
            }
            Body::empty()
        })())
        .unwrap()
}
/// Clones a request including the body, if existing.
///
/// # Panics
/// If the provided request does not have the [`header::CONTENT_TYPE`] set.
Clones a request including the body, if existing.
Clones a request including the body if existing .
fn clone_request(request: &Request<Body>, body: Option<&Vec<u8>>) -> Request<Body> {
    Request::builder()
        .method(request.method())
        .header(
            header::CONTENT_TYPE,
            request
                .headers()
                .get(header::CONTENT_TYPE)
                .expect("Cannot clone request without a content-type header."),
        )
        .uri(request.uri().clone())
        .body((|| {
            if body.is_some() {
                return Body::from(body.unwrap().clone());
            }
            Body::empty()
        })())
        .unwrap()
}
fn clone_request ( request : & Request < Body > , body : Option < & Vec < u8 > > ) -> Request < Body > { Request :: builder ( ) . method ( request . method ( ) ) . header ( header :: CONTENT_TYPE , request . headers ( ) . get ( header :: CONTENT_TYPE ) . expect ( " " ) , ) . uri ( request . uri ( ) . clone ( ) ) . body ( ( | | { if body . is_some ( ) { return Body :: from ( body . unwrap ( ) . clone ( ) ) ; } Body :: empty ( ) } ) ( ) ) . unwrap ( ) }
Clones a request including the body, if existing.
Clones a request including the body if existing .
request
&Request<Body>
body
Option<&Vec<u8>>
panics
If the provided request does not have the [`header::CONTENT_TYPE`] set.
If the provided request does not have the [ ` header :: CONTENT_TYPE ` ] set .