1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

Merge pull request #214 from niklasf/de-path-404

let Path::from_request() fail with ErrorNotFound
This commit is contained in:
Nikolay Kim 2018-05-08 14:41:05 -07:00 committed by GitHub
commit ba816a8562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,8 @@
* Fix connector's default `keep-alive` and `lifetime` settings #212
* Send `ErrorNotFound` instead of `ErrorBadRequest` when path extractor fails #214
## 0.6.0 (2018-05-08)
* Add route scopes #202

View File

@ -11,7 +11,7 @@ use serde::de::{self, DeserializeOwned};
use serde_urlencoded;
use de::PathDeserializer;
use error::{Error, ErrorBadRequest};
use error::{Error, ErrorNotFound, ErrorBadRequest};
use handler::{AsyncResult, FromRequest};
use httpmessage::{HttpMessage, MessageBody, UrlEncoded};
use httprequest::HttpRequest;
@ -108,7 +108,7 @@ where
fn from_request(req: &HttpRequest<S>, _: &Self::Config) -> Self::Result {
let req = req.clone();
de::Deserialize::deserialize(PathDeserializer::new(&req))
.map_err(|e| e.into())
.map_err(ErrorNotFound)
.map(|inner| Path { inner })
}
}