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:
@ -8,4 +8,4 @@ actix-web = "2.0"
|
||||
actix-rt = "1.0"
|
||||
serde = "1.0"
|
||||
futures = "0.3.1"
|
||||
bytes = "0.4"
|
||||
bytes = "0.5"
|
||||
|
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user