fixup! Very simple CORS implementation

This commit is contained in:
Artem Biryukov 2017-01-19 04:26:29 +03:00
parent 9d7ad109cd
commit cb713c478d
No known key found for this signature in database
GPG Key ID: AC9644A627DDAA9D
4 changed files with 6 additions and 2 deletions

View File

@ -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"]

View File

@ -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")]

View File

@ -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"] }

View File

@ -17,6 +17,6 @@ fn hello() -> CORS<String> {
fn main() {
rocket::ignite()
.mount("/", routes![cors_preflight, hello])
.mount("/", routes![hello])
.launch();
}