/// Encode a struct as a form and set as the response body.
///
/// # Mime
///
/// The encoding is set to `application/x-www-form-urlencoded`.
Encode a struct as a form and set as the response body.
Encode a struct as a form and set as the response body .
pub async fn body_form<T: serde::Serialize>(
        mut self,
        form: T,
    ) -> Result<Self, serde_qs::Error> {
        // TODO: think about how to handle errors
        self.res.set_body(serde_qs::to_string(&form)?.into_bytes());
        Ok(self
            .set_status(StatusCode::Ok)
            .set_mime(mime::APPLICATION_WWW_FORM_URLENCODED))
    }
pub async fn body_form < T : serde :: Serialize > ( mut self , form : T , ) -> Result < Self , serde_qs :: Error > { // TODO: think about how to handle errors self . res . set_body ( serde_qs :: to_string ( & form ) ? . into_bytes ( ) ) ; Ok ( self . set_status ( StatusCode :: Ok ) . set_mime ( mime :: APPLICATION_WWW_FORM_URLENCODED ) ) }
Encode a struct as a form and set as the response body.
Encode a struct as a form and set as the response body .
mut self
form
T
mime
The encoding is set to `application/x-www-form-urlencoded`.
The encoding is set to ` application / x - www - form - urlencoded ` .