1
0
mirror of https://github.com/actix/actix-website synced 2025-06-27 15:39:02 +02:00

fix chunked example

This commit is contained in:
Nikolay Kim
2020-01-02 18:36:32 +06:00
parent b8e2a2310c
commit 4fffc16668
3 changed files with 3 additions and 16 deletions

View File

@ -1,12 +1,11 @@
// <chunked>
use actix_web::{web, HttpRequest, HttpResponse};
use actix_web::{web, HttpRequest, HttpResponse, Error};
use bytes::Bytes;
use futures::future::ok;
use futures::stream::once;
async fn index(req: HttpRequest) -> HttpResponse {
HttpResponse::Ok()
.chunked()
.streaming(once(ok::<_, Error>(Bytes::from_static(b"data"))))
}
// </chunked>
@ -17,6 +16,5 @@ pub fn main() {
HttpServer::new(|| App::new().route("/", web::get().to(index)))
.bind("127.0.0.1:8088")
.unwrap()
.run()
.unwrap();
.run();
}