1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-01 08:45:10 +02:00

remove time dep from actix-http (#2383)

This commit is contained in:
Rob Ede
2021-09-11 00:01:01 +01:00
committed by GitHub
parent ba88d3b4bf
commit 46699e3429
12 changed files with 109 additions and 204 deletions

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::{format_description::well_known::Rfc3339, OffsetDateTime};
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]