cors: allow credentials

Signed-off-by: ATechnoHazard <amolele@gmail.com>
This commit is contained in:
Amogh Lele 2020-09-26 11:41:05 +05:30
parent d8abb1ed58
commit 84e3def3f8
No known key found for this signature in database
GPG Key ID: F475143EDEDEBA3C

View File

@ -8,11 +8,13 @@ pub mod user;
pub fn fuel(rocket: Rocket) -> Rocket { pub fn fuel(rocket: Rocket) -> Rocket {
let mut rocket = rocket; let mut rocket = rocket;
let mut cors_options = CorsOptions::default(); let mut cors_options = CorsOptions::default();
cors_options.expose_headers.insert("Set-Cookie".to_owned()); cors_options.expose_headers.insert("Set-Cookie".to_owned());
let cors = cors_options.to_cors().unwrap(); cors_options.allow_credentials(true);
rocket = health::fuel(rocket); rocket = health::fuel(rocket);
rocket = paste::fuel(rocket); rocket = paste::fuel(rocket);
rocket = user::fuel(rocket); rocket = user::fuel(rocket);
rocket.attach(cors) rocket.attach(cors_options.to_cors().unwrap())
} }