pub fn login(&mut self, username: &str, password: &str) -> Result<Response, Error> {
        let body = form_urlencoded::serialize(vec![("credential_0", username),
                                                   ("credential_1", password),
                                                   ("destination", "/")]);
        let s = format!("{}/LOGIN", self.origin);
        let res = match self.client
                            .post(&s)
                            .body(&body)
                            .header(ContentType::form_url_encoded())
                            .send() {
            Ok(x) => x,
            Err(e) => {
                return Err(Error::Hyper(e));
            }
        };
        match res.headers.get::<SetCookie>() {
            Some(header) => self.cookie.0 = header.0.to_owned(),
            None => {
                return Err(Error::Authentication);
            }
        }
        Ok(res)
    }
/// Logs into the Airwave API.
Logs into the Airwave API.
Logs into the Airwave API .
pub fn login(&mut self, username: &str, password: &str) -> Result<Response, Error> {
        let body = form_urlencoded::serialize(vec![("credential_0", username),
                                                   ("credential_1", password),
                                                   ("destination", "/")]);
        let s = format!("{}/LOGIN", self.origin);
        let res = match self.client
                            .post(&s)
                            .body(&body)
                            .header(ContentType::form_url_encoded())
                            .send() {
            Ok(x) => x,
            Err(e) => {
                return Err(Error::Hyper(e));
            }
        };
        match res.headers.get::<SetCookie>() {
            Some(header) => self.cookie.0 = header.0.to_owned(),
            None => {
                return Err(Error::Authentication);
            }
        }
        Ok(res)
    }
pub fn login ( & mut self , username : & str , password : & str ) -> Result < Response , Error > { let body = form_urlencoded :: serialize ( vec ! [ ( " " username ) ( " " password ) ( " " " " ) ] ) ; let s = format ! ( " " self origin ) ; let res = match self . client . post ( & s ) . body ( & body ) . header ( ContentType :: form_url_encoded ( ) ) . send ( ) { Ok ( x ) => x , Err ( e ) => { return Err ( Error :: Hyper ( e ) ) ; } } ; match res . headers . get :: < SetCookie > ( ) { Some ( header ) => self . cookie . 0 = header . 0 . to_owned ( ) , None => { return Err ( Error :: Authentication ) ; } } Ok ( res ) }
Logs into the Airwave API.
Logs into the Airwave API .
&mut self
username
&str
password
&str
&mut self
username
&str
password
&str