mco_http/header/common/
access_control_allow_methods.rs

1use crate::method::Method;
2
3header! {
4    /// `Access-Control-Allow-Methods` header, part of
5    /// [CORS](http://www.w3.org/TR/cors/#access-control-allow-methods-response-header)
6    ///
7    /// The `Access-Control-Allow-Methods` header indicates, as part of the
8    /// response to a preflight request, which methods can be used during the
9    /// actual request.
10    ///
11    /// # ABNF
12    /// ```plain
13    /// Access-Control-Allow-Methods: "Access-Control-Allow-Methods" ":" #Method
14    /// ```
15    ///
16    /// # Example values
17    /// * `PUT, DELETE, XMODIFY`
18    ///
19    /// # Examples
20    /// ```
21    /// use mco_http::header::{Headers, AccessControlAllowMethods};
22    /// use mco_http::method::Method;
23    ///
24    /// let mut headers = Headers::new();
25    /// headers.set(
26    ///     AccessControlAllowMethods(vec![Method::Get])
27    /// );
28    /// ```
29    /// ```
30    /// use mco_http::header::{Headers, AccessControlAllowMethods};
31    /// use mco_http::method::Method;
32    ///
33    /// let mut headers = Headers::new();
34    /// headers.set(
35    ///     AccessControlAllowMethods(vec![
36    ///         Method::Get,
37    ///         Method::Post,
38    ///         Method::Patch,
39    ///         Method::Extension("COPY".to_owned()),
40    ///     ])
41    /// );
42    /// ```
43    (AccessControlAllowMethods, "Access-Control-Allow-Methods") => (Method)*
44
45    test_access_control_allow_methods {
46        test_header!(test1, vec![b"PUT, DELETE, XMODIFY"]);
47    }
48}