pub struct Cors {
pub allow_origin: Vec<String>,
pub allow_methods: String,
pub allow_credentials: bool,
pub expose_headers: String,
pub max_age: i32,
/* private fields */
}Expand description
跨域资源共享
Fields§
§allow_origin: Vec<String>源
allow_methods: String请求中可以使用那些请求方法
allow_credentials: bool响应暴露给前端 JavaScript
expose_headers: String跨域请求请求头中允许携带的除Cache-Controller、Content-Language、Content-Type、Expires、Last-Modified、Pragma这六个基本字段之外的其他字段信息
max_age: i32准备响应前的缓存持续的最大时间(以秒为单位,目的是减少浏览器预检请求/响应交互的数量。默认值1800s。设置了该值后,浏览器将在设置值的时间段内对该跨域请求不再发起预请求
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Cors
impl Send for Cors
impl Sync for Cors
impl Unpin for Cors
impl UnwindSafe for Cors
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
Mutably borrows from an owned value. Read more