I am getting an error message when submitting HTML form in order to catch the requested details inside FORM (I am using actix-web).
When I submit the FORM, I am getting this error:
Content type error
The code used:
#[derive(Deserialize)]
struct FormData {
paire: String,
}
fn showit(form: web::Form<FormData>) -> String {
println!("Value to show: {}", form.paire);
form.paire.clone()
}
....
.service(
web::resource("/")
.route(web::get().to(showit))
.route(web::head().to(|| HttpResponse::MethodNotAllowed()))
))
HTML form used:
<form action="http://127.0.0.1:8080/" method="get">
<input type="text" name="paire" value="Example of value to show">
<input type="submit">
The expected result will be:
Example of value to show