1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use method::Method;
#[derive(Clone, PartialEq, Debug)]
pub struct Allow(pub Vec<Method>);
impl_list_header!(Allow,
"Allow",
Vec<Method>);
#[cfg(test)]
mod tests {
use super::Allow;
use header::Header;
use method::Method::{self, Options, Get, Put, Post, Delete, Head, Trace, Connect, Patch, Extension};
#[test]
fn test_allow() {
let mut allow: Option<Allow>;
allow = Header::parse_header([b"OPTIONS,GET,PUT,POST,DELETE,HEAD,TRACE,CONNECT,PATCH,fOObAr".to_vec()].as_slice());
assert_eq!(allow, Some(Allow(vec![Options, Get, Put, Post, Delete, Head, Trace, Connect, Patch, Extension("fOObAr".to_string())])));
allow = Header::parse_header([b"".to_vec()].as_slice());
assert_eq!(allow, Some(Allow(Vec::<Method>::new())));
}
}
bench_header!(bench, Allow, { vec![b"OPTIONS,GET,PUT,POST,DELETE,HEAD,TRACE,CONNECT,PATCH,fOObAr".to_vec()] });