mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-04-20 06:54:46 +00:00
support copying headers in cors preflight requests
This commit is contained in:
parent
b005346e54
commit
766bc9d17d
5 changed files with 188 additions and 47 deletions
|
@ -196,7 +196,7 @@ authentication), and every content type, could look like this:
|
|||
# #[cfg(feature = "cors")]
|
||||
# mod cors_feature_enabled {
|
||||
# use gotham::{hyper::header::*, router::builder::*, pipeline::{new_pipeline, single::single_pipeline}, state::State};
|
||||
# use gotham_restful::*;
|
||||
# use gotham_restful::{*, cors::*};
|
||||
# use serde::{Deserialize, Serialize};
|
||||
#[derive(Resource)]
|
||||
#[resource(read_all)]
|
||||
|
@ -210,7 +210,7 @@ fn read_all() {
|
|||
fn main() {
|
||||
let cors = CorsConfig {
|
||||
origin: Origin::Copy,
|
||||
headers: vec![CONTENT_TYPE],
|
||||
headers: Headers::List(vec![CONTENT_TYPE]),
|
||||
max_age: 0,
|
||||
credentials: true
|
||||
};
|
||||
|
@ -417,9 +417,9 @@ mod auth;
|
|||
pub use auth::{AuthHandler, AuthMiddleware, AuthSource, AuthStatus, AuthValidation, StaticAuthHandler};
|
||||
|
||||
#[cfg(feature = "cors")]
|
||||
mod cors;
|
||||
pub mod cors;
|
||||
#[cfg(feature = "cors")]
|
||||
pub use cors::{handle_cors, CorsConfig, CorsRoute, Origin};
|
||||
pub use cors::{handle_cors, CorsConfig, CorsRoute};
|
||||
|
||||
#[cfg(feature = "openapi")]
|
||||
mod openapi;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue