refactor(headers): Add tests and docs to CORS headers

This commit is contained in:
Pyfisch
2015-04-28 09:32:48 +02:00
parent f9d75e4dd3
commit e993f4b544
6 changed files with 66 additions and 12 deletions

View File

@@ -1,17 +1,22 @@
use std::fmt::{self};
use std::fmt;
use std::str;
use url::Url;
use header;
/// The `Access-Control-Allow-Origin` response header,
/// part of [CORS](http://www.w3.org/TR/cors/).
/// part of [CORS](www.w3.org/TR/cors/#access-control-allow-origin-response-header)
///
/// > The `Access-Control-Allow-Origin` header indicates whether a resource
/// > can be shared based by returning the value of the Origin request header,
/// > "*", or "null" in the response.
/// The `Access-Control-Allow-Origin` header indicates whether a resource
/// can be shared based by returning the value of the Origin request header,
/// "*", or "null" in the response.
///
/// Spec: www.w3.org/TR/cors/#access-control-allow-origin-response-header
/// # ABNF
/// ```plain
/// Access-Control-Allow-Origin = "Access-Control-Allow-Origin" ":" origin-list-or-null | "*"
/// ```
// FIXME: The documentation says differently (missing "null" value, "*" not used in practice,
// orgin list no list but single value)
#[derive(Clone, PartialEq, Debug)]
pub enum AccessControlAllowOrigin {
/// Allow all origins