//! This example shows how to use urlencoded to parse GET request parameters. extern crate iron; extern crate urlencoded; use iron::prelude::*; use iron::status; use urlencoded::UrlEncodedQuery; fn log_params(req: &mut Request) -> IronResult { // Extract the decoded data as hashmap, using the UrlEncodedQuery plugin. match req.get_ref::() { Ok(ref hashmap) => println!("Parsed GET request query string:\n {:?}", hashmap), Err(ref e) => println!("{:?}", e) }; Ok(Response::with((status::Ok, "Hello!"))) } // Test out the server with `curl -i "http://localhost:3000/?name=franklin&name=trevor"` fn main() { Iron::new(log_params).http("127.0.0.1:3000").unwrap(); }