mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 01:32:57 +01:00
let Path::from_request() fail with ErrorNotFound
This commit is contained in:
parent
b3cc43bb9b
commit
6f75b0e95e
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
* Fix connector's default `keep-alive` and `lifetime` settings #212
|
* 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)
|
## 0.6.0 (2018-05-08)
|
||||||
|
|
||||||
* Add route scopes #202
|
* Add route scopes #202
|
||||||
|
@ -11,7 +11,7 @@ use serde::de::{self, DeserializeOwned};
|
|||||||
use serde_urlencoded;
|
use serde_urlencoded;
|
||||||
|
|
||||||
use de::PathDeserializer;
|
use de::PathDeserializer;
|
||||||
use error::{Error, ErrorBadRequest};
|
use error::{Error, ErrorNotFound, ErrorBadRequest};
|
||||||
use handler::{AsyncResult, FromRequest};
|
use handler::{AsyncResult, FromRequest};
|
||||||
use httpmessage::{HttpMessage, MessageBody, UrlEncoded};
|
use httpmessage::{HttpMessage, MessageBody, UrlEncoded};
|
||||||
use httprequest::HttpRequest;
|
use httprequest::HttpRequest;
|
||||||
@ -108,7 +108,7 @@ where
|
|||||||
fn from_request(req: &HttpRequest<S>, _: &Self::Config) -> Self::Result {
|
fn from_request(req: &HttpRequest<S>, _: &Self::Config) -> Self::Result {
|
||||||
let req = req.clone();
|
let req = req.clone();
|
||||||
de::Deserialize::deserialize(PathDeserializer::new(&req))
|
de::Deserialize::deserialize(PathDeserializer::new(&req))
|
||||||
.map_err(|e| e.into())
|
.map_err(ErrorNotFound)
|
||||||
.map(|inner| Path { inner })
|
.map(|inner| Path { inner })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user