hyperx/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 /// # extern crate http;
24 /// use hyperx::header::{AccessControlAllowMethods, TypedHeaders};
25 /// use hyperx::Method;
26 ///
27 /// let mut headers = http::HeaderMap::new();
28 /// headers.encode(
29 /// &AccessControlAllowMethods(vec![Method::Get])
30 /// );
31 /// ```
32 ///
33 /// ```
34 /// # extern crate http;
35 /// use hyperx::header::{AccessControlAllowMethods, TypedHeaders};
36 /// use hyperx::Method;
37 ///
38 /// let mut headers = http::HeaderMap::new();
39 /// headers.encode(
40 /// &AccessControlAllowMethods(vec![
41 /// Method::Get,
42 /// Method::Post,
43 /// Method::Patch,
44 /// Method::Extension("COPY".to_owned()),
45 /// ])
46 /// );
47 /// ```
48 (AccessControlAllowMethods, "Access-Control-Allow-Methods") => (Method)*
49
50 test_access_control_allow_methods {
51 test_header!(test1, vec![b"PUT, DELETE, XMODIFY"]);
52 }
53}
54
55standard_header!(AccessControlAllowMethods, ACCESS_CONTROL_ALLOW_METHODS);