mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-08 10:42:37 +00:00
722ee93f8b
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`.
27 lines
503 B
Rust
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];
|
|
}
|