update time crate in actix-web

This commit is contained in:
Rob Ede 2021-09-10 23:20:16 +01:00
parent bf5c5f8e82
commit 6952699611
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 4 additions and 4 deletions

View File

@ -101,7 +101,7 @@ serde_json = "1.0"
serde_urlencoded = "0.7"
smallvec = "1.6.1"
socket2 = "0.4.0"
time = { version = "0.2.23", default-features = false, features = ["std"] }
time = { version = "0.3", default-features = false, features = ["formatting"] }
url = "2.1"
[dev-dependencies]

View File

@ -18,7 +18,7 @@ use bytes::Bytes;
use futures_core::ready;
use log::{debug, warn};
use regex::{Regex, RegexSet};
use time::OffsetDateTime;
use time::{OffsetDateTime, format_description::well_known::Rfc3339};
use crate::{
dev::{BodySize, MessageBody},
@ -538,7 +538,7 @@ impl FormatText {
};
}
FormatText::UrlPath => *self = FormatText::Str(req.path().to_string()),
FormatText::RequestTime => *self = FormatText::Str(now.format("%Y-%m-%dT%H:%M:%S")),
FormatText::RequestTime => *self = FormatText::Str(now.format(&Rfc3339).unwrap()),
FormatText::RequestHeader(ref name) => {
let s = if let Some(val) = req.headers().get(name) {
if let Ok(s) = val.to_str() {
@ -767,7 +767,7 @@ mod tests {
Ok(())
};
let s = format!("{}", FormatDisplay(&render));
assert!(s.contains(&now.format("%Y-%m-%dT%H:%M:%S")));
assert!(s.contains(&now.format(&Rfc3339).unwrap()));
}
#[actix_rt::test]