mirror of https://github.com/rwf2/Rocket.git
fixup! Very simple CORS implementation
This commit is contained in:
parent
9d7ad109cd
commit
cb713c478d
|
@ -12,6 +12,7 @@ license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["json"]
|
default = ["json"]
|
||||||
|
cors = []
|
||||||
json = ["serde", "serde_json"]
|
json = ["serde", "serde_json"]
|
||||||
tera_templates = ["tera", "templates"]
|
tera_templates = ["tera", "templates"]
|
||||||
handlebars_templates = ["handlebars", "templates"]
|
handlebars_templates = ["handlebars", "templates"]
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#[cfg(feature = "lazy_static_macro")]
|
#[cfg(feature = "lazy_static_macro")]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
|
|
||||||
|
#[cfg(feature = "cors")]
|
||||||
mod cors;
|
mod cors;
|
||||||
|
|
||||||
#[cfg_attr(feature = "json", macro_use)]
|
#[cfg_attr(feature = "json", macro_use)]
|
||||||
|
@ -52,6 +53,7 @@ mod templates;
|
||||||
#[cfg(feature = "uuid")]
|
#[cfg(feature = "uuid")]
|
||||||
mod uuid;
|
mod uuid;
|
||||||
|
|
||||||
|
#[cfg(feature = "cors")]
|
||||||
pub use cors::{PreflightCORS, CORS};
|
pub use cors::{PreflightCORS, CORS};
|
||||||
|
|
||||||
#[cfg(feature = "json")]
|
#[cfg(feature = "json")]
|
||||||
|
|
|
@ -9,8 +9,9 @@ rocket = { path = "../../lib" }
|
||||||
rocket_codegen = { path = "../../codegen" }
|
rocket_codegen = { path = "../../codegen" }
|
||||||
|
|
||||||
[dependencies.rocket_contrib]
|
[dependencies.rocket_contrib]
|
||||||
default-features = true
|
default-features = false
|
||||||
path = "../../contrib"
|
path = "../../contrib"
|
||||||
|
features = ["cors"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rocket = { path = "../../lib", features = ["testing"] }
|
rocket = { path = "../../lib", features = ["testing"] }
|
|
@ -17,6 +17,6 @@ fn hello() -> CORS<String> {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
rocket::ignite()
|
rocket::ignite()
|
||||||
.mount("/", routes![cors_preflight, hello])
|
.mount("/", routes![hello])
|
||||||
.launch();
|
.launch();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue