mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
Call req.path() on Json extractor error only (#945)
* Call req.path() on Json extractor error only * Cleanup len parse code
This commit is contained in:
parent
af9fb5d190
commit
44bb79cd07
@ -180,16 +180,14 @@ where
|
||||
.map(|c| (c.limit, c.ehandler.clone(), c.content_type.clone()))
|
||||
.unwrap_or((32768, None, None));
|
||||
|
||||
let path = req.path().to_string();
|
||||
|
||||
Box::new(
|
||||
JsonBody::new(req, payload, ctype)
|
||||
.limit(limit)
|
||||
.map_err(move |e| {
|
||||
log::debug!(
|
||||
"Failed to deserialize Json from payload. \
|
||||
Request path: {:?}",
|
||||
path
|
||||
Request path: {}",
|
||||
req2.path()
|
||||
);
|
||||
if let Some(err) = err {
|
||||
(*err)(e, &req2)
|
||||
@ -324,14 +322,11 @@ where
|
||||
};
|
||||
}
|
||||
|
||||
let mut len = None;
|
||||
if let Some(l) = req.headers().get(&CONTENT_LENGTH) {
|
||||
if let Ok(s) = l.to_str() {
|
||||
if let Ok(l) = s.parse::<usize>() {
|
||||
len = Some(l)
|
||||
}
|
||||
}
|
||||
}
|
||||
let len = req
|
||||
.headers()
|
||||
.get(&CONTENT_LENGTH)
|
||||
.and_then(|l| l.to_str().ok())
|
||||
.and_then(|s| s.parse::<usize>().ok());
|
||||
let payload = Decompress::from_headers(payload.take(), req.headers());
|
||||
|
||||
JsonBody {
|
||||
|
Loading…
Reference in New Issue
Block a user