requiem_http/header/common/last_modified.rs
1use crate::header::{HttpDate, LAST_MODIFIED};
2
3header! {
4 /// `Last-Modified` header, defined in
5 /// [RFC7232](http://tools.ietf.org/html/rfc7232#section-2.2)
6 ///
7 /// The `Last-Modified` header field in a response provides a timestamp
8 /// indicating the date and time at which the origin server believes the
9 /// selected representation was last modified, as determined at the
10 /// conclusion of handling the request.
11 ///
12 /// # ABNF
13 ///
14 /// ```text
15 /// Expires = HTTP-date
16 /// ```
17 ///
18 /// # Example values
19 ///
20 /// * `Sat, 29 Oct 1994 19:43:31 GMT`
21 ///
22 /// # Example
23 ///
24 /// ```rust
25 /// use requiem_http::Response;
26 /// use requiem_http::http::header::LastModified;
27 /// use std::time::{SystemTime, Duration};
28 ///
29 /// let mut builder = Response::Ok();
30 /// let modified = SystemTime::now() - Duration::from_secs(60 * 60 * 24);
31 /// builder.set(LastModified(modified.into()));
32 /// ```
33 (LastModified, LAST_MODIFIED) => [HttpDate]
34
35 test_last_modified {
36 // Test case from RFC
37 test_header!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]);}
38}