pub struct CorsConfig {
pub allow_origins: Vec<String>,
pub allow_methods: Vec<String>,
pub allow_headers: Vec<String>,
pub expose_headers: Vec<String>,
pub max_age: Option<u64>,
pub allow_credentials: bool,
}Expand description
CORS policy configuration for HTTP handler tests.
~keep Each list accepts BOTH the allow_* field name and the allowed_* alias, because the
two spellings are already load-bearing in opposite directions: every emitter writes
allowed_* into the generated harness on purpose (codegen::java::tests asserts
allow_origins is absent from the output), so fixture authors reasonably write allowed_*
too. Without the alias serde silently dropped those keys onto #[serde(default)] and
produced an empty policy – a CORS config that denies everything, spelled exactly like one
that permits something. It fails open into a 403 on every preflight, and the fixtures that
assert rejection still pass, so the suite reports green on a policy it never applied. A
missing constraint must never be indistinguishable from a satisfied one.
Fields§
§allow_origins: Vec<String>Allowed origins (e.g. ["https://example.com"]). Empty means deny all.
allow_methods: Vec<String>Allowed HTTP methods (e.g. ["GET", "POST"]). Empty means deny all.
allow_headers: Vec<String>Allowed request headers (e.g. ["Content-Type"]). Empty means deny all.
expose_headers: Vec<String>Exposed response headers (e.g. ["X-Total-Count"]).
max_age: Option<u64>Access-Control-Max-Age value in seconds.
allow_credentials: boolWhether to allow credentials.
Trait Implementations§
Source§impl Clone for CorsConfig
impl Clone for CorsConfig
Source§fn clone(&self) -> CorsConfig
fn clone(&self) -> CorsConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CorsConfig
impl Debug for CorsConfig
Source§impl Default for CorsConfig
impl Default for CorsConfig
Source§fn default() -> CorsConfig
fn default() -> CorsConfig
Source§impl<'de> Deserialize<'de> for CorsConfig
impl<'de> Deserialize<'de> for CorsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CorsConfig
impl RefUnwindSafe for CorsConfig
impl Send for CorsConfig
impl Sync for CorsConfig
impl Unpin for CorsConfig
impl UnsafeUnpin for CorsConfig
impl UnwindSafe for CorsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more