pub async fn parse_reply_expecting(
        &mut self,
        valid_statuses: Vec<StatusCodeKind>,
    ) -> Result<ServerResponse, crate::error::Error> {
        let response = self.parse_reply().await?;

        let is_expected_status = valid_statuses.contains(&response.status_code.kind);
        // We are a bit liberal on what we accept.
        let is_positive_status = response.status_code.is_valid();
        warn!(
            "Unexpected positive status was accepted: {:?}",
            response.status_code
        );

        if is_expected_status || is_positive_status {
            Ok(response)
        } else {
            Err(crate::error::Error::UnexpectedStatusCode(
                response.summarize_error(valid_statuses),
            ))
        }
    }
/// Parse the server reply into a ServerResponse expecting a list of status codes.
Parse the server reply into a ServerResponse expecting a list of status codes.
Parse the server reply into a ServerResponse expecting a list of status codes .
pub async fn parse_reply_expecting(
        &mut self,
        valid_statuses: Vec<StatusCodeKind>,
    ) -> Result<ServerResponse, crate::error::Error> {
        let response = self.parse_reply().await?;
        let is_expected_status = valid_statuses.contains(&response.status_code.kind);
        // We are a bit liberal on what we accept.
        let is_positive_status = response.status_code.is_valid();
        warn!(
            "Unexpected positive status was accepted: {:?}",
            response.status_code
        );
        if is_expected_status || is_positive_status {
            Ok(response)
        } else {
            Err(crate::error::Error::UnexpectedStatusCode(
                response.summarize_error(valid_statuses),
            ))
        }
    }
pub async fn parse_reply_expecting ( & mut self , valid_statuses : Vec < StatusCodeKind > , ) -> Result < ServerResponse , crate :: error :: Error > { let response = self . parse_reply ( ) . await ? ; let is_expected_status = valid_statuses . contains ( & response . status_code . kind ) ; // We are a bit liberal on what we accept. let is_positive_status = response . status_code . is_valid ( ) ; warn ! ( " " response status_code ) ; if is_expected_status || is_positive_status { Ok ( response ) } else { Err ( crate :: error :: Error :: UnexpectedStatusCode ( response . summarize_error ( valid_statuses ) , ) ) } }
Parse the server reply into a ServerResponse expecting a list of status codes.
Parse the server reply into a ServerResponse expecting a list of status codes .
&mut self
valid_statuses
Vec<StatusCodeKind>
&mut self
valid_statuses
Vec<StatusCodeKind>