hyper_sync/header/common/
access_control_allow_methods.rs

1use 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    ///
13    /// ```text
14    /// Access-Control-Allow-Methods: "Access-Control-Allow-Methods" ":" #Method
15    /// ```
16    ///
17    /// # Example values
18    /// * `PUT, DELETE, XMODIFY`
19    ///
20    /// # Examples
21    ///
22    /// ```
23    /// use hyper_sync::header::{Headers, AccessControlAllowMethods};
24    /// use hyper_sync::Method;
25    ///
26    /// let mut headers = Headers::new();
27    /// headers.set(
28    ///     AccessControlAllowMethods(vec![Method::Get])
29    /// );
30    /// ```
31    ///
32    /// ```
33    /// use hyper_sync::header::{Headers, AccessControlAllowMethods};
34    /// use hyper_sync::Method;
35    ///
36    /// let mut headers = Headers::new();
37    /// headers.set(
38    ///     AccessControlAllowMethods(vec![
39    ///         Method::Get,
40    ///         Method::Post,
41    ///         Method::Patch,
42    ///         Method::Extension("COPY".to_owned()),
43    ///     ])
44    /// );
45    /// ```
46    (AccessControlAllowMethods, "Access-Control-Allow-Methods") => (Method)*
47
48    test_access_control_allow_methods {
49        test_header!(test1, vec![b"PUT, DELETE, XMODIFY"]);
50    }
51}