mirror of https://github.com/fafhrd91/actix-web
update time crate in actix-web
This commit is contained in:
parent
bf5c5f8e82
commit
6952699611
|
@ -101,7 +101,7 @@ serde_json = "1.0"
|
||||||
serde_urlencoded = "0.7"
|
serde_urlencoded = "0.7"
|
||||||
smallvec = "1.6.1"
|
smallvec = "1.6.1"
|
||||||
socket2 = "0.4.0"
|
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"
|
url = "2.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -18,7 +18,7 @@ use bytes::Bytes;
|
||||||
use futures_core::ready;
|
use futures_core::ready;
|
||||||
use log::{debug, warn};
|
use log::{debug, warn};
|
||||||
use regex::{Regex, RegexSet};
|
use regex::{Regex, RegexSet};
|
||||||
use time::OffsetDateTime;
|
use time::{OffsetDateTime, format_description::well_known::Rfc3339};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
dev::{BodySize, MessageBody},
|
dev::{BodySize, MessageBody},
|
||||||
|
@ -538,7 +538,7 @@ impl FormatText {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
FormatText::UrlPath => *self = FormatText::Str(req.path().to_string()),
|
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) => {
|
FormatText::RequestHeader(ref name) => {
|
||||||
let s = if let Some(val) = req.headers().get(name) {
|
let s = if let Some(val) = req.headers().get(name) {
|
||||||
if let Ok(s) = val.to_str() {
|
if let Ok(s) = val.to_str() {
|
||||||
|
@ -767,7 +767,7 @@ mod tests {
|
||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
let s = format!("{}", FormatDisplay(&render));
|
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]
|
#[actix_rt::test]
|
||||||
|
|
Loading…
Reference in New Issue