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