Rocket/codegen/tests/run-pass/complete-decorator.rs
Sergio Benitez 722ee93f8b Update to cookie 0.7. Use 256-bit session_keys.
This commit involves several breaking changes:
  * `session_key` config param must be a 256-bit base64 encoded string.
  * `FromRequest` is implemented for `Cookies`, not `Cookie`.
  * Only a single `Cookies` instance can be retrieved at a time.
  * `Config::take_session_key` returns a `Vec<u8>`.
  * `Into<Header>` is implemented for `&Cookie`, not `Cookie`.
2017-03-07 01:19:06 -08:00

27 lines
503 B
Rust

#![feature(plugin, custom_derive)]
#![plugin(rocket_codegen)]
extern crate rocket;
use rocket::http::Cookies;
use rocket::request::Form;
#[derive(FromForm)]
struct User<'a> {
name: &'a str,
nickname: String,
}
#[post("/<name>?<query>", format = "application/json", data = "<user>", rank = 2)]
fn get<'r>(name: &str,
query: User<'r>,
user: Form<'r, User<'r>>,
cookies: Cookies)
-> &'static str {
"hi"
}
fn main() {
let _ = routes![get];
}