From 0ab8bc11f3c8113440e1e7af4580e031e4fb93b1 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 26 Feb 2018 16:41:57 -0800 Subject: [PATCH] fix guide example --- guide/src/qs_7.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guide/src/qs_7.md b/guide/src/qs_7.md index 66ffcb63..448d28ea 100644 --- a/guide/src/qs_7.md +++ b/guide/src/qs_7.md @@ -169,15 +169,18 @@ get enabled automatically. Enabling chunked encoding for *HTTP/2.0* responses is forbidden. ```rust +# extern crate bytes; # extern crate actix_web; # extern crate futures; # use futures::Stream; use actix_web::*; +use bytes::Bytes; +use futures::stream::once; fn index(req: HttpRequest) -> HttpResponse { HttpResponse::Ok() .chunked() - .body(Body::Streaming(Box::new(payload::Payload::empty().from_err()))).unwrap() + .body(Body::Streaming(Box::new(once(Ok(Bytes::from_static(b"data")))))).unwrap() } # fn main() {} ```