1use HeaderValue;
23/// `Location` header, defined in
4/// [RFC7231](http://tools.ietf.org/html/rfc7231#section-7.1.2)
5///
6/// The `Location` header field is used in some responses to refer to a
7/// specific resource in relation to the response. The type of
8/// relationship is defined by the combination of request method and
9/// status code semantics.
10///
11/// # ABNF
12///
13/// ```text
14/// Location = URI-reference
15/// ```
16///
17/// # Example values
18/// * `/People.html#tim`
19/// * `http://www.example.net/index.html`
20///
21/// # Examples
22///
23#[derive(Clone, Debug, PartialEq)]
24pub struct Location(HeaderValue);
2526derive_header! {
27 Location(_),
28 name: LOCATION
29}
3031#[cfg(test)]
32mod tests {
33use super::super::test_decode;
34use super::*;
3536#[test]
37fn absolute_uri() {
38let s = "http://www.example.net/index.html";
39let loc = test_decode::<Location>(&[s]).unwrap();
4041assert_eq!(loc, Location(HeaderValue::from_static(s)));
42 }
4344#[test]
45fn relative_uri_with_fragment() {
46let s = "/People.html#tim";
47let loc = test_decode::<Location>(&[s]).unwrap();
4849assert_eq!(loc, Location(HeaderValue::from_static(s)));
50 }
51}