pub fn form<T: DeserializeOwned + Send>() -> impl Filter<Extract = (T,), Error = Rejection> + Copy
Expand description
Returns a Filter
that matches any request and extracts a
Future
of a form encoded body.
§Note
This filter is for the simpler application/x-www-form-urlencoded
format,
not multipart/form-data
.
§Warning
This does not have a default size limit, it would be wise to use one to prevent a overly large request from using too much memory.
use std::collections::HashMap;
use warp::Filter;
let route = warp::body::content_length_limit(1024 * 32)
.and(warp::body::form())
.map(|simple_map: HashMap<String, String>| {
"Got a urlencoded body!"
});