mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
net: Stop using both versions of the time
crate in the cookie code (#33260)
`std::time` is good enough for us here. `cookie` is using `time 0.3`, but Servo can convert to standard library types when getting data from `cookie`. This reduces our direct dependencies and removes more use of the very old `time 0.1` series. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
1e9344cb5c
commit
6f333a8e29
9 changed files with 29 additions and 95 deletions
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use cookie::{Cookie, CookieBuilder};
|
||||
use headers::ContentType;
|
||||
use http::header::{self, HeaderMap, HeaderValue};
|
||||
|
@ -15,7 +17,6 @@ use http::StatusCode;
|
|||
use hyper::{Method, Uri};
|
||||
use hyper_serde::{De, Ser};
|
||||
use serde_test::{assert_de_tokens, assert_ser_tokens, Token};
|
||||
use time_03::Duration;
|
||||
|
||||
#[test]
|
||||
fn test_content_type() {
|
||||
|
@ -32,7 +33,7 @@ fn test_cookie() {
|
|||
// string with a bunch of indices in it which apparently is different from the exact same
|
||||
// cookie but parsed as a bunch of strings.
|
||||
let cookie: Cookie = CookieBuilder::new("Hello", "World!")
|
||||
.max_age(Duration::seconds(42))
|
||||
.max_age(Duration::from_secs(42).try_into().unwrap_or_default())
|
||||
.domain("servo.org")
|
||||
.path("/")
|
||||
.secure(true)
|
||||
|
@ -111,17 +112,6 @@ fn test_raw_status() {
|
|||
assert_de_tokens(&De::new(raw_status), tokens);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tm() {
|
||||
use time::strptime;
|
||||
|
||||
let time = strptime("2017-02-22T12:03:31Z", "%Y-%m-%dT%H:%M:%SZ").unwrap();
|
||||
let tokens = &[Token::Str("2017-02-22T12:03:31Z")];
|
||||
|
||||
assert_ser_tokens(&Ser::new(&time), tokens);
|
||||
assert_de_tokens(&De::new(time), tokens);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_uri() {
|
||||
use std::str::FromStr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue