pub fn login(srv: &mut TestServer, _username: &str) -> Option<String> {
    let request = srv.post().uri(srv.url("/login")).finish().unwrap();

    println!("{:?}", request);
    let response = srv.execute(request.send()).unwrap();
    println!("{:?}", response);
    assert!(response.status() == StatusCode::OK, "Login Failed");

    match response.headers().get(RESPONSE_HEADER) {
        Some(token) => Some(token.to_str().unwrap().to_string()),
        None => None,
    }
}
/// Attempts to log a user in with the given username
/// Note: The server automatically assumes authentication passes
///
/// # Arguments
///
/// * `srv` - An instance of a TestServer
/// * `username` - Username to login
Attempts to log a user in with the given username
Note: The server automatically assumes authentication passes
Attempts to log a user in with the given username Note : The server automatically assumes authentication passes
pub fn login(srv: &mut TestServer, _username: &str) -> Option<String> {
    let request = srv.post().uri(srv.url("/login")).finish().unwrap();
    println!("{:?}", request);
    let response = srv.execute(request.send()).unwrap();
    println!("{:?}", response);
    assert!(response.status() == StatusCode::OK, "Login Failed");
    match response.headers().get(RESPONSE_HEADER) {
        Some(token) => Some(token.to_str().unwrap().to_string()),
        None => None,
    }
}
pub fn login ( srv : & mut TestServer , _username : & str ) -> Option < String > { let request = srv . post ( ) . uri ( srv . url ( " " ) ) . finish ( ) . unwrap ( ) ; println ! ( " " request ) ; let response = srv . execute ( request . send ( ) ) . unwrap ( ) ; println ! ( " " response ) ; assert ! ( response status ( ) StatusCode OK " " ) ; match response . headers ( ) . get ( RESPONSE_HEADER ) { Some ( token ) => Some ( token . to_str ( ) . unwrap ( ) . to_string ( ) ) , None => None , } }
Attempts to log a user in with the given username
Note: The server automatically assumes authentication passes
Attempts to log a user in with the given username Note : The server automatically assumes authentication passes
srv
&mut TestServer
_username
&str
srv
&mut TestServer
_username
&str