diff --git a/contrib/Cargo.toml b/contrib/Cargo.toml index dfe743e1..7a99685d 100644 --- a/contrib/Cargo.toml +++ b/contrib/Cargo.toml @@ -12,6 +12,7 @@ license = "MIT/Apache-2.0" [features] default = ["json"] +cors = [] json = ["serde", "serde_json"] tera_templates = ["tera", "templates"] handlebars_templates = ["handlebars", "templates"] diff --git a/contrib/src/lib.rs b/contrib/src/lib.rs index 851fe878..7acb3ec9 100644 --- a/contrib/src/lib.rs +++ b/contrib/src/lib.rs @@ -40,6 +40,7 @@ #[cfg(feature = "lazy_static_macro")] extern crate lazy_static; +#[cfg(feature = "cors")] mod cors; #[cfg_attr(feature = "json", macro_use)] @@ -52,6 +53,7 @@ mod templates; #[cfg(feature = "uuid")] mod uuid; +#[cfg(feature = "cors")] pub use cors::{PreflightCORS, CORS}; #[cfg(feature = "json")] diff --git a/examples/cors/Cargo.toml b/examples/cors/Cargo.toml index bdfae231..5525b9d0 100644 --- a/examples/cors/Cargo.toml +++ b/examples/cors/Cargo.toml @@ -9,8 +9,9 @@ rocket = { path = "../../lib" } rocket_codegen = { path = "../../codegen" } [dependencies.rocket_contrib] -default-features = true +default-features = false path = "../../contrib" +features = ["cors"] [dev-dependencies] rocket = { path = "../../lib", features = ["testing"] } \ No newline at end of file diff --git a/examples/cors/src/main.rs b/examples/cors/src/main.rs index f4c3f25b..34b5d1f2 100644 --- a/examples/cors/src/main.rs +++ b/examples/cors/src/main.rs @@ -17,6 +17,6 @@ fn hello() -> CORS { fn main() { rocket::ignite() - .mount("/", routes![cors_preflight, hello]) + .mount("/", routes![hello]) .launch(); }