Help for using Actix Query

Hello,

I wrote this code for Actix, where I would like to convert my POST's datas to the struct Name2 :

#[derive(Debug, Deserialize)]
pub struct Name2 {
    fname: String,
    lname: String,
}
async fn data_serde_post(_req: HttpRequest, data: web::Json<Name2>) -> impl Responder {
    let mut body = String::new();
    body.push_str(format!("First name : {:?}<br/>", data.fname).as_str());
    body.push_str(format!("Last name  : {:?}<br/>", data.lname).as_str());

    HttpResponse::Ok()
        .insert_header(ContentType::html())
        .body(body)
}

But it sends the response : "Content type error".
Have you an idea ? Or maybe an hint to have a more complete error message (because learn how to fish is better than giving a fish :slight_smile: ) ?

Ha ! I have to use web::Form instead of web::Json :sweat_smile:
Sorry