1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-30 00:29:29 +02:00

use FromRequest instead of HttpRequestExtractor

This commit is contained in:
Nikolay Kim
2018-03-29 13:12:28 -07:00
parent dfd8f1058e
commit 86dd732704
8 changed files with 93 additions and 93 deletions

View File

@@ -10,11 +10,10 @@ use serde::Serialize;
use serde::de::DeserializeOwned;
use error::{Error, JsonPayloadError, PayloadError};
use handler::Responder;
use handler::{Responder, FromRequest};
use httpmessage::HttpMessage;
use httprequest::HttpRequest;
use httpresponse::HttpResponse;
use extractor::HttpRequestExtractor;
/// Json helper
///
@@ -112,13 +111,13 @@ impl<T: Serialize> Responder for Json<T> {
}
}
impl<T, S> HttpRequestExtractor<S> for Json<T>
impl<T, S> FromRequest<S> for Json<T>
where T: DeserializeOwned + 'static, S: 'static
{
type Result = Box<Future<Item=Self, Error=Error>>;
#[inline]
fn extract(req: &HttpRequest<S>) -> Self::Result {
fn from_request(req: &HttpRequest<S>) -> Self::Result {
Box::new(
JsonBody::new(req.clone())
.from_err()