fn post_handler(mut state: State) -> Box<HandlerFuture> {
    print_request_elements(&state);
    let f = Body::take_from(&mut state)
        .concat2()
        .then(|full_body| match full_body {
            Ok(valid_body) => {
                let body_content = String::from_utf8(valid_body.to_vec()).unwrap();
                println!("Body: {}", body_content);
                let res = create_response(&state, StatusCode::Ok, None);
                future::ok((state, res))
            }
            Err(e) => return future::err((state, e.into_handler_error())),
        });

    Box::new(f)
}
/// Extracts the elements of the POST request and prints them
Extracts the elements of the POST request and prints them
Extracts the elements of the POST request and prints them
fn post_handler(mut state: State) -> Box<HandlerFuture> {
    print_request_elements(&state);
    let f = Body::take_from(&mut state)
        .concat2()
        .then(|full_body| match full_body {
            Ok(valid_body) => {
                let body_content = String::from_utf8(valid_body.to_vec()).unwrap();
                println!("Body: {}", body_content);
                let res = create_response(&state, StatusCode::Ok, None);
                future::ok((state, res))
            }
            Err(e) => return future::err((state, e.into_handler_error())),
        });
    Box::new(f)
}
fn post_handler ( mut state : State ) -> Box < HandlerFuture > { print_request_elements ( & state ) ; let f = Body :: take_from ( & mut state ) . concat2 ( ) . then ( | full_body | match full_body { Ok ( valid_body ) => { let body_content = String :: from_utf8 ( valid_body . to_vec ( ) ) . unwrap ( ) ; println ! ( " " body_content ) ; let res = create_response ( & state , StatusCode :: Ok , None ) ; future :: ok ( ( state , res ) ) } Err ( e ) => return future :: err ( ( state , e . into_handler_error ( ) ) ) , } ) ; Box :: new ( f ) }
Extracts the elements of the POST request and prints them
Extracts the elements of the POST request and prints them
state
State
state
State