mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
replate time::Duration
with chrono::Duration
and add max_age_time
method (#789)
* feat: replate time::Duration with chrono::Duration * feat: rename max_age method which accepts `Duration` to max_age_time and add new max_age method accepting isize of seconds * feat: replace `time:Duration` with `chrono:Duration` in repo `actix-http`
This commit is contained in:
@ -93,6 +93,7 @@ flate2 = { version="1.0.7", optional = true, default-features = false }
|
||||
# optional deps
|
||||
failure = { version = "0.1.5", optional = true }
|
||||
openssl = { version="0.10", optional = true }
|
||||
chrono = "0.4.6"
|
||||
|
||||
[dev-dependencies]
|
||||
actix-rt = "0.2.2"
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use time::{Duration, Tm};
|
||||
use time::Tm;
|
||||
use chrono::Duration;
|
||||
|
||||
use super::{Cookie, SameSite};
|
||||
|
||||
@ -16,7 +17,7 @@ use super::{Cookie, SameSite};
|
||||
///
|
||||
/// ```rust
|
||||
/// use actix_http::cookie::Cookie;
|
||||
/// use time::Duration;
|
||||
/// use chrono::Duration;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let cookie: Cookie = Cookie::build("name", "value")
|
||||
@ -200,7 +201,7 @@ impl CookieBuilder {
|
||||
///
|
||||
/// ```rust
|
||||
/// use actix_http::cookie::Cookie;
|
||||
/// use time::Duration;
|
||||
/// use chrono::Duration;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::collections::HashSet;
|
||||
use std::mem::replace;
|
||||
|
||||
use time::{self, Duration};
|
||||
use chrono::Duration;
|
||||
|
||||
use super::delta::DeltaCookie;
|
||||
use super::Cookie;
|
||||
@ -188,7 +188,7 @@ impl CookieJar {
|
||||
///
|
||||
/// ```rust
|
||||
/// use actix_http::cookie::{CookieJar, Cookie};
|
||||
/// use time::Duration;
|
||||
/// use chrono::Duration;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let mut jar = CookieJar::new();
|
||||
@ -241,7 +241,7 @@ impl CookieJar {
|
||||
///
|
||||
/// ```rust
|
||||
/// use actix_http::cookie::{CookieJar, Cookie};
|
||||
/// use time::Duration;
|
||||
/// use chrono::Duration;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let mut jar = CookieJar::new();
|
||||
@ -538,7 +538,7 @@ mod test {
|
||||
#[cfg(feature = "secure-cookies")]
|
||||
fn delta() {
|
||||
use std::collections::HashMap;
|
||||
use time::Duration;
|
||||
use chrono::Duration;
|
||||
|
||||
let mut c = CookieJar::new();
|
||||
|
||||
|
@ -66,7 +66,8 @@ use std::fmt;
|
||||
use std::str::FromStr;
|
||||
|
||||
use percent_encoding::{percent_encode, USERINFO_ENCODE_SET};
|
||||
use time::{Duration, Tm};
|
||||
use time::Tm;
|
||||
use chrono::Duration;
|
||||
|
||||
pub use self::builder::CookieBuilder;
|
||||
pub use self::draft::*;
|
||||
@ -624,7 +625,7 @@ impl<'c> Cookie<'c> {
|
||||
///
|
||||
/// ```rust
|
||||
/// use actix_http::cookie::Cookie;
|
||||
/// use time::Duration;
|
||||
/// use chrono::Duration;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let mut c = Cookie::new("name", "value");
|
||||
@ -703,7 +704,7 @@ impl<'c> Cookie<'c> {
|
||||
///
|
||||
/// ```rust
|
||||
/// use actix_http::cookie::Cookie;
|
||||
/// use time::Duration;
|
||||
/// use chrono::Duration;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let mut c = Cookie::new("foo", "bar");
|
||||
@ -977,7 +978,8 @@ impl<'a, 'b> PartialEq<Cookie<'b>> for Cookie<'a> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Cookie, SameSite};
|
||||
use time::{strptime, Duration};
|
||||
use time::strptime;
|
||||
use chrono::Duration;
|
||||
|
||||
#[test]
|
||||
fn format() {
|
||||
|
@ -6,7 +6,7 @@ use std::fmt;
|
||||
use std::str::Utf8Error;
|
||||
|
||||
use percent_encoding::percent_decode;
|
||||
use time::{self, Duration};
|
||||
use chrono::Duration;
|
||||
|
||||
use super::{Cookie, CookieStr, SameSite};
|
||||
|
||||
@ -220,7 +220,8 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Cookie, SameSite};
|
||||
use time::{strptime, Duration};
|
||||
use time::strptime;
|
||||
use chrono::Duration;
|
||||
|
||||
macro_rules! assert_eq_parse {
|
||||
($string:expr, $expected:expr) => {
|
||||
|
Reference in New Issue
Block a user