actori_http/header/common/
expires.rs

1use crate::header::{HttpDate, EXPIRES};
2
3header! {
4    /// `Expires` header, defined in [RFC7234](http://tools.ietf.org/html/rfc7234#section-5.3)
5    ///
6    /// The `Expires` header field gives the date/time after which the
7    /// response is considered stale.
8    ///
9    /// The presence of an Expires field does not imply that the original
10    /// resource will change or cease to exist at, before, or after that
11    /// time.
12    ///
13    /// # ABNF
14    ///
15    /// ```text
16    /// Expires = HTTP-date
17    /// ```
18    ///
19    /// # Example values
20    /// * `Thu, 01 Dec 1994 16:00:00 GMT`
21    ///
22    /// # Example
23    ///
24    /// ```rust
25    /// use actori_http::Response;
26    /// use actori_http::http::header::Expires;
27    /// use std::time::{SystemTime, Duration};
28    ///
29    /// let mut builder = Response::Ok();
30    /// let expiration = SystemTime::now() + Duration::from_secs(60 * 60 * 24);
31    /// builder.set(Expires(expiration.into()));
32    /// ```
33    (Expires, EXPIRES) => [HttpDate]
34
35    test_expires {
36        // Test case from RFC
37        test_header!(test1, vec![b"Thu, 01 Dec 1994 16:00:00 GMT"]);
38    }
39}