extern crate iron; extern crate qiniu_multipart; use iron::prelude::*; use qiniu_multipart::server::iron::Intercept; use qiniu_multipart::server::Entries; fn main() { // We start with a basic request handler chain. let mut chain = Chain::new(|req: &mut Request| { if let Some(entries) = req.extensions.get::() { Ok(Response::with(format!("{:?}", entries))) } else { Ok(Response::with("Not a multipart request")) } }); // `Intercept` will read out the entries and place them as an extension in the request. // It has various builder-style methods for changing how it will behave, but has sane settings // by default. chain.link_before(Intercept::default()); Iron::new(chain).http("localhost:80").unwrap(); }