mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-25 18:09:22 +02:00
add protobuf feature
This commit is contained in:
@ -12,4 +12,4 @@ prost = "0.2.0"
|
||||
prost-derive = "0.2.0"
|
||||
|
||||
actix = "0.5"
|
||||
actix-web = { path="../../" }
|
||||
actix-web = { path="../../", features=["protobuf"] }
|
||||
|
@ -8,6 +8,7 @@ extern crate prost;
|
||||
extern crate prost_derive;
|
||||
|
||||
use actix_web::*;
|
||||
use actix_web::ProtoBufBody;
|
||||
use futures::Future;
|
||||
|
||||
|
||||
@ -22,7 +23,7 @@ pub struct MyObj {
|
||||
|
||||
/// This handler uses `HttpRequest::json()` for loading serde json object.
|
||||
fn index(req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
|
||||
req.protobuf()
|
||||
ProtoBufBody::new(req)
|
||||
.from_err() // convert all errors into `Error`
|
||||
.and_then(|val: MyObj| {
|
||||
println!("model: {:?}", val);
|
||||
|
Reference in New Issue
Block a user