# Forms
HTML forms typically submit data as application/x-www-form-urlencoded. Actix Web provides the web::Form extractor to handle this data type easily.
#Extracting Form Data
Like JSON and Query extractors, Form extraction relies on Serde.
code_blocksrust
use actix_web::{post, web, HttpResponse};
use serde::Deserialize;
#[derive(Deserialize)]
struct Login {
username: String,
password: String,
}
#[post("/login")]
async fn login(form: web::Form<Login>) -> HttpResponse {
HttpResponse::Ok().body(format!("User {} logged in", form.username))
}#Form Configuration
Similar to JSON, you can configure the maximum payload size for forms to protect your server.
code_blocksrust
use actix_web::{web, App};
App::new().app_data(web::FormConfig::default().limit(16384))