Rename Options to Cors

This commit is contained in:
Yong Wen Chua 2017-07-15 11:03:24 +08:00
parent d23c935a4a
commit ad25352bdd
1 changed files with 8 additions and 2 deletions

View File

@ -336,6 +336,8 @@ impl<'a, 'r> FromRequest<'a, 'r> for AccessControlRequestHeaders {
}
/// An enum signifying that some of type T is allowed, or `All` (everything is allowed).
///
/// `Default` is implemented for this enum and is `All`.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AllOrSome<T> {
@ -372,9 +374,10 @@ impl AllOrSome<HashSet<Url>> {
}
}
/// Responder and Fairing for CORS
/// Responder generator and [Fairing](https://rocket.rs/guide/fairings/) for CORS
///
/// This struct can be used as Fairing for Rocket, or as an ad-hoc responder for any CORS requests.
///
/// You create a new copy of this struct by defining the configurations in the fields below.
/// This struct can also be deserialized by serde.
///
@ -395,6 +398,8 @@ pub struct Cors {
/// This is the `list of origins` in the
/// [Resource Processing Model](https://www.w3.org/TR/cors/#resource-processing-model).
///
/// Defaults to `All`.
///
/// ```
// #[serde(default)]
pub allowed_origins: AllOrSome<HashSet<Url>>,
@ -513,7 +518,8 @@ impl Cors {
}
}
/// A CORS Responder which will inspect the incoming requests and respond accordingly.
/// A CORS [Responder](https://rocket.rs/guide/responses/#responder)
/// which will inspect the incoming requests and respond accordingly.
///
/// If the wrapped `Responder` already has the `Access-Control-Allow-Origin` header set,
/// this responder will leave the response untouched.