1
0
mirror of https://github.com/actix/actix-website synced 2024-11-26 01:32:42 +01:00
actix-website/examples/requests/src/urlencoded.rs

23 lines
634 B
Rust
Raw Normal View History

2019-06-17 20:34:23 +02:00
// <urlencoded>
// use actix_web::{Error, HttpRequest, HttpResponse};
// use futures::future::{ok, Future};
// use serde::Deserialize;
// #[derive(Deserialize)]
// struct FormData {
// username: String,
// }
// fn index(req: &HttpRequest) -> Box<Future<Item = HttpResponse, Error = Error>> {
// req.urlencoded::<FormData>() // <- get UrlEncoded future
// .from_err()
// .and_then(|data| {
// // <- deserialized instance
// println!("USERNAME: {:?}", data.username);
// ok(HttpResponse::Ok().into())
// })
// .responder()
// }
// </urlencoded>
fn main() {}