Hi there,
I'm trying to receive some form_data, send through a POST-request, and access them. However, I don't know how to manage that. My minimal code looks like this:
use actix_web::{web, App, HttpServer, HttpResponse, Responder};
use form_data::{handle_multipart, Form, Field};
use actix_multipart::Multipart;
fn send((mp, state): (Multipart, web::Data<Form>)) -> impl Responder {
handle_multipart(mp, state.get_ref().clone());
/*
* My plan is, that now the received data are stored in "state"
*
*/
println!("{:?}", state);
HttpResponse::Ok()
}
fn main() -> std::io::Result<()> {
let form = Form::new().field("test",Field::text());
HttpServer::new(move || App::new()
.data(form.clone())
.route("/send", web::post().to(send)))
.bind("127.0.0.1:8080")?
.run()
}
Thanks for your help!