pub fn build(self) -> Result<AnonymousSession, InitialisationError> {
        let timeout = match self.timeout {
            Some(timeout) => timeout,
            None => DEFAULT_TIMEOUT,
        };

        let user_agent = match self.user_agent {
            Some(user_agent) => user_agent,
            None => FEDORA_USER_AGENT,
        };

        // set default headers for our requests
        // - User Agent
        // - Accept: application/json
        let mut headers = HeaderMap::new();

        headers.insert(USER_AGENT, HeaderValue::from_str(user_agent).unwrap());

        headers.insert(ACCEPT, HeaderValue::from_str("application/json").unwrap());

        // construct reqwest session with:
        // - custom default headers
        // - no-redirects policy
        let client = Client::builder()
            .default_headers(headers)
            .cookie_store(true)
            .timeout(timeout)
            .redirect(Policy::none())
            .build()?;

        Ok(AnonymousSession { client })
    }
/// This method consumes the builder and attempts to build the session.
This method consumes the builder and attempts to build the session.
This method consumes the builder and attempts to build the session .
pub fn build(self) -> Result<AnonymousSession, InitialisationError> {
        let timeout = match self.timeout {
            Some(timeout) => timeout,
            None => DEFAULT_TIMEOUT,
        };
        let user_agent = match self.user_agent {
            Some(user_agent) => user_agent,
            None => FEDORA_USER_AGENT,
        };
        // set default headers for our requests
        // - User Agent
        // - Accept: application/json
        let mut headers = HeaderMap::new();
        headers.insert(USER_AGENT, HeaderValue::from_str(user_agent).unwrap());
        headers.insert(ACCEPT, HeaderValue::from_str("application/json").unwrap());
        // construct reqwest session with:
        // - custom default headers
        // - no-redirects policy
        let client = Client::builder()
            .default_headers(headers)
            .cookie_store(true)
            .timeout(timeout)
            .redirect(Policy::none())
            .build()?;
        Ok(AnonymousSession { client })
    }
pub fn build ( self ) -> Result < AnonymousSession , InitialisationError > { let timeout = match self . timeout { Some ( timeout ) => timeout , None => DEFAULT_TIMEOUT , } ; let user_agent = match self . user_agent { Some ( user_agent ) => user_agent , None => FEDORA_USER_AGENT , } ; // set default headers for our requests // - User Agent // - Accept: application/json let mut headers = HeaderMap :: new ( ) ; headers . insert ( USER_AGENT , HeaderValue :: from_str ( user_agent ) . unwrap ( ) ) ; headers . insert ( ACCEPT , HeaderValue :: from_str ( " " ) . unwrap ( ) ) ; // construct reqwest session with: // - custom default headers // - no-redirects policy let client = Client :: builder ( ) . default_headers ( headers ) . cookie_store ( true ) . timeout ( timeout ) . redirect ( Policy :: none ( ) ) . build ( ) ? ; Ok ( AnonymousSession { client } ) }
This method consumes the builder and attempts to build the session.
This method consumes the builder and attempts to build the session .
self
self